From 8e3d91d5ae19b7afaace1dea4a52abdb9323bda0 Mon Sep 17 00:00:00 2001 From: Bella | Nightshade Date: Wed, 27 Mar 2019 08:49:34 +0930 Subject: [PATCH] Make API token send in new message for mobile-friendly copying --- src/pluralkit/bot/commands/api_commands.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/pluralkit/bot/commands/api_commands.py b/src/pluralkit/bot/commands/api_commands.py index 2e658279..71814bee 100644 --- a/src/pluralkit/bot/commands/api_commands.py +++ b/src/pluralkit/bot/commands/api_commands.py @@ -18,14 +18,17 @@ async def token_get(ctx: CommandContext): else: token = await system.refresh_token(ctx.conn) - token_message = "Here's your API token: \n**`{}`**\n{}".format(token, disclaimer) - return await ctx.reply_ok_dm(token_message) - + token_message = "{}\n\u2705 Here's your API token:".format(disclaimer) + if token: + await ctx.message.author.send(token_message) + await ctx.message.author.send(token) + return async def token_refresh(ctx: CommandContext): system = await ctx.ensure_system() token = await system.refresh_token(ctx.conn) - token_message = "Your previous API token has been invalidated. You will need to change it anywhere it's currently used.\nHere's your new API token:\n**`{}`**\n{}".format( - token, disclaimer) - return await ctx.reply_ok_dm(token_message) + token_message = "Your previous API token has been invalidated. You will need to change it anywhere it's currently used.\n{}\n\u2705 Here's your new API token:".format(disclaimer) + if token: + await ctx.message.author.send(token_message) + await ctx.message.author.send(token)