Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- import datetime
- import os
- import json
- TOKEN = 'NTY2NzIzNjI2NDA2MTE3Mzg2.XLfuhQ.Q5OGelMS2VbR97Jf5XkzWAzw96c'
- server_id = 566723507925417990
- client = discord.Client()
- date_time = datetime.datetime.now()
- channels = ["bot-commands"]
- admin_users = ['AuraBoom#2712']
- @client.event
- async def on_message(message):
- #Logs commands TIME:USER:COMMAND
- def output(command):
- now = datetime.datetime.now()
- time = now.strftime('%e/%m/%y %H:%M')
- print(str(time) + ':' + str(message.author) + ' ran the command ' + command)
- commandlog(str(time) + ':' + str(message.author) + ' ran the command ' + command + "\n")
- def commandlog(log):
- with open('commandloglist.txt', 'a+') as file:
- file.write(log)
- #Commands
- id = client.get_guild(server_id)
- #Admin (Works)
- if str(message.channel) in channels and str(message.author) in admin_users:
- if message.content.startswith("!admin"):
- await message.channel.send("You are an admin")
- output('!admin')
- #Hello (Works)
- if str(message.channel) in channels:
- if message.content.startswith("!hello"):
- await message.channel.send('Hello')
- output('!hello')
- #Members (Works)
- if str(message.channel) in channels:
- if message.content.startswith("!members"):
- await message.channel.send(f"""There are {id.member_count} members""")
- output('!members')
- #Purge (Works)
- if str(message.author) in admin_users:
- if message.content.startswith("!purge"):
- output("!purge")
- split_purge = message.content.split(' ')
- amount = int(split_purge[1])
- channel = message.channel
- if len(split_purge) < 2:
- return
- if len(split_purge) == 2:
- await channel.purge(limit=amount)
- #Give role (Not working)
- if str(message.channel) in channels:
- if message.content.startswith("!userrole"):
- user_role = None
- for role in guild.roles:
- if role == 'User':
- user_role = role
- break
- await message.author.add_roles(roles=[user_role])
- client.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement