# bot.py import os import random import discord import guptoken import insult_generator TOKEN = guptoken.getToken() intents = discord.Intents.default() intents.message_content = True intents.members = True client = discord.Client(intents=intents) @client.event async def on_ready(): print(f'{client.user} has connected to Discord!') @client.event async def on_message(message): if message.author == client.user: return if message.content.startswith("!insult"): print(f'Message: {message.content}') l = message.content.split(" ") target = message.author if (len(l) > 1): # Associate given name with online discord target if (l[1].startswith("<@")): target_id = int(l[1][2:-1]) print(f'{target_id}') m = message.channel.members for member in m: if (member.display_name.lower() == l[1].lower() or member.id == id): target = member break response = f'{target.mention} is a {insult_generator.hit_me(3, odds_of_adding_another_word=0.75)}!' await message.channel.send(response) return if (message.content.startswith("!survivor")): survivors = ["Acrid", "Artificer", "Bandit", "Captain", "Commando", "Engineer", "Huntress", "Loader", "MUL-T", "Mercenary", "REX", "Railgunner", "Void Fiend"] s = random.choice(survivors) response = f'{message.author.mention} play {s}, you {insult_generator.hit_me(2)}' await message.channel.send(response) return if (message.content.startswith("!help")): response = f'{message.author.mention} go screw yourself, {insult_generator.hit_me(1)}' await message.channel.send(response) return if (message.content.startswith("!")): response = f'{message.author.mention} uh, *wat*? For a list of commands, type !help.' await message.channel.send(response) return client.run(TOKEN)