From cb9fd7b06e07250e2e77aaec1625b701cd157dcb Mon Sep 17 00:00:00 2001 From: archfan <33993466+archfan7411@users.noreply.github.com> Date: Thu, 29 Aug 2019 08:36:25 -0400 Subject: [PATCH] Optionally use Discord nicknames --- README.md | 1 + relay.conf | 1 + server.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c39b19..d642363 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ port = 8080 channel_id = 576585506658189332 allow_logins = true clean_invites = true +use_nicknames = true ``` 4. Set `discord.port` in your `minetest.conf` to match the port you used in `relay.conf`. You may also set `discord.text_color` to a hex color string if you'd like to color relayed messages from Discord. diff --git a/relay.conf b/relay.conf index d40e1e8..a84e095 100644 --- a/relay.conf +++ b/relay.conf @@ -6,3 +6,4 @@ port = 8080 channel_id = allow_logins = true clean_invites = true +use_nicknames = true \ No newline at end of file diff --git a/server.py b/server.py index 0118d9a..06e7943 100644 --- a/server.py +++ b/server.py @@ -50,6 +50,7 @@ port = int(config['RELAY']['port']) token = config['BOT']['token'] logins_allowed = True if config['RELAY']['allow_logins'] == 'true' else False do_clean_invites = True if config['RELAY']['clean_invites'] == 'true' else False +do_use_nicknames = True if config['RELAY']['use_nicknames'] == 'true' else False last_request = 0 @@ -113,7 +114,7 @@ async def on_message(message): if check_timeout(): if (message.channel.id == channel_id) and (message.author.id != bot.user.id): msg = { - 'author': message.author.name, + 'author': message.author.name if not do_use_nicknames else message.author.display_name, 'content': message.content.replace('\n', '/') } if do_clean_invites: