added setmusicroom
This commit is contained in:
parent
6b81c4d8d0
commit
dcc1f68f7b
21
bot.py
21
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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue