From dcc1f68f7b470f5576ef29b8f0554cbc80d788d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=B3nya=20M=C3=A1rton?= Date: Tue, 21 Jul 2020 13:14:10 +0200 Subject: [PATCH] added setmusicroom --- bot.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 9f4ea59..6f5e3fd 100644 --- a/bot.py +++ b/bot.py @@ -4,6 +4,7 @@ from dotenv import load_dotenv from discord.ext import commands + def checkEnv(): print('Checking if token.env exists...') try: @@ -27,17 +28,32 @@ TOKEN = os.getenv('DISCORD_TOKEN') # ZENEID = os.getenv('ZENEKOMMAND_ID') # YEPID = os.getenv('YEP_ID') -client = commands.Bot(command_prefix='!') +client = commands.Bot(command_prefix='$') + +@client.command() +async def setmusicroom(ctx, arg): + server = ctx.guild + channel = discord.utils.get(server.channels, name=arg) + channelid = channel.id + file = open('setup.env', 'w') + file.write(f'MUSICCHANNEL={channelid}') + file.close() + load_dotenv('setup.env') + +async def help(ctx): + await ctx.send('This is the help!') @client.event async def on_message(message): if message.author == client.user: return + await client.process_commands(message) + server = message.guild channel = discord.utils.get(server.channels, name=message.channel.name) print(channel.id) - channel_zene = client.get_channel(733950770927370250) + channel_zene = client.get_channel(int(os.getenv('MUSICCHANNEL'))) channel_yep = client.get_channel(733950633291546686) # if str(message.author) == 'Rythm#3722': @@ -59,6 +75,7 @@ async def on_message(message): await message.delete() await message.channel.send('!disconnect') + # if str(channel_yep) == str(message.channel) and message.author == 'Rythm': # message.delete()