From 6d4f0d7e8d05589ee80598ba8894c697a0647273 Mon Sep 17 00:00:00 2001 From: Lukas Nedbalek Date: Tue, 24 Sep 2024 15:13:52 +0200 Subject: [PATCH] rf: message sending --- main.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 4aae035..83b97a9 100644 --- a/main.py +++ b/main.py @@ -4,7 +4,14 @@ from configparser import ConfigParser # Bot token (replace with your own) TOKEN = 'MTE1NDc0ODQ3MzE4MzMwNTc4OQ.Gz_Q7u.02sb2YNV_QQy7Bs19roXlB62mjoMKA6y8aubHU' -# Iterate over the sections in the config file + + +async def reply_error(ctx: commands.Context, message: str): + await reply(ctx, f'**Error:** {message}', True) + + +async def reply(ctx: commands.Context, message: str): + await ctx.send(message) def get_server_IDs(): @@ -60,9 +67,9 @@ async def grant_role(ctx, study_group_name: str): if role is not None: await author.add_roles(role) - await ctx.send(f'{author.mention} has been granted the {study_group_name} role on server {guild.name}.') + await reply(ctx, f'{author.mention} has been granted the {study_group_name} role on the [{guild.name}] server.') return - await ctx.send('Something gone wrong. Please check your command and try again.') + await reply_error(ctx, 'Something went wrong. Please check your command and try again.') return