Initial commit.

This commit is contained in:
2025-01-20 18:22:18 +00:00
committed by Dylan Smith
commit 9f2c6ba7c5
5 changed files with 416 additions and 0 deletions

65
gupbot.py Normal file
View File

@@ -0,0 +1,65 @@
# bot.py
import os
import random
import discord
import guptoken
import insult_generator
TOKEN = guptoken.getToken()
intents = discord.Intents.default()
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(" ")
if (len(l) <= 1):
return
id = 0
if (l[1].startswith("<@")):
id = int(l[1][2:-1])
print(f'{id}')
m = message.channel.members
print(f'Terrrgetted user: {l[1]}')
print(f'Members: {m}')
for member in m:
print(f'Checking {member.display_name}, {member.id}...')
if (member.display_name.lower() == l[1].lower() or member.id == id):
response = f'{member.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)