From 2f32840c92c20ec28fda734fce8f6bab1fc1d9d5 Mon Sep 17 00:00:00 2001 From: CMDR furrycat Date: Tue, 14 Feb 2017 14:33:19 +0000 Subject: [PATCH] Added url command to get invite URL. --- app.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 145c773..4b302ff 100644 --- a/app.py +++ b/app.py @@ -63,7 +63,7 @@ def show_help(message, *args): command = None if command is None: - valid_commands = ['coords', 'close_to', 'direction', 'distance', 'edts', 'find', 'fuel_usage', 'galmath', 'id', 'raikogram', 'time'] + valid_commands = ['coords', 'close_to', 'direction', 'distance', 'edts', 'find', 'fuel_usage', 'galmath', 'id', 'raikogram', 'time', 'url'] valid_commands += plugins.valid_commands() lines = [ '<@{}>, the cat-like robot from the 34th century of the future, recognises these commands (and more):'.format(client.user.id), @@ -82,6 +82,11 @@ def show_help(message, *args): '```time```', 'Useful for `announce create` or to check in-game time.' ] + elif command == 'url': + lines = [ + 'Show URL to invite me to a server.', + '```url```' + ] elif command in ['coords', 'close_to', 'direction', 'distance', 'edts', 'find', 'fuel_usage', 'galmath', 'raikogram']: params = modules['edi'] fn = params['fn'] @@ -160,6 +165,11 @@ def do_commands(message, command, raw, non_admin): yield from bot.maybe_play_sound(bot.voice_channel_for_user(message.author), 'purr.wav', join = False) return + elif command == 'url': + # Invite URL. + yield from bot.say(message.channel, "<{}>".format(discord.utils.oauth_url(client.user.id))) + return + yield from bot.maybe_say(message.channel, 'purr', wake = False) yield from bot.maybe_play_sound(bot.voice_channel_for_user(message.author), 'purr.wav', join = False) @@ -206,7 +216,7 @@ modules = { 'any': { 'fn': do_commands, 'args': [True], - 'commands': ['help', 'time'] + 'commands': ['help', 'time', 'url'] }, 'edi': { 'fn': do_edi, -- 2.7.4