Update main.py

This commit is contained in:
Elmon11 2020-12-19 16:54:24 +01:00 committed by GitHub
parent 39539cff2b
commit 8c29037909
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,8 +17,7 @@ load_dotenv()
botToken = os.getenv('botToken') botToken = os.getenv('botToken')
intents = discord.Intents.all() intents = discord.Intents.all()
bot = commands.Bot(command_prefix=os.getenv('prefix'), bot = commands.Bot(command_prefix=get_prefix, case_insensitive=True, description='TotalFreedom bot help command', intents=intents)
description='TotalFreedom bot help command', intents=intents)
extensions = [ extensions = [
@ -42,6 +41,9 @@ if __name__ == '__main__':
@bot.event @bot.event
async def on_message(message): async def on_message(message):
if isinstance(message.channel, discord.channel.DMChannel):
print(f'{message.author} DM: {message.content}')
return
if message.guild and message.author is message.guild.me and message.channel.id == reports_channel_id: if message.guild and message.author is message.guild.me and message.channel.id == reports_channel_id:
await message.add_reaction(clipboard) await message.add_reaction(clipboard)
if message.type == discord.MessageType.new_member: if message.type == discord.MessageType.new_member:
@ -71,7 +73,6 @@ async def on_message(message):
await message.delete() await message.delete()
await message.channel.send(f"{message.author.mention} do not post invite links to other discord servers.") await message.channel.send(f"{message.author.mention} do not post invite links to other discord servers.")
if message.content.lower().startswith(os.getenv('prefix')): await bot.process_commands(message)
await bot.process_commands(message)
bot.run(botToken) bot.run(botToken)