rf: message sending

This commit is contained in:
Lukáš Nedbálek 2024-09-24 15:13:52 +02:00
parent 5c4729a284
commit 6d4f0d7e8d

13
main.py
View file

@ -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