Fix insult generator
This commit is contained in:
21
gupbot.py
21
gupbot.py
@@ -8,6 +8,7 @@ import insult_generator
|
||||
TOKEN = guptoken.getToken()
|
||||
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
intents.members = True
|
||||
client = discord.Client(intents=intents)
|
||||
|
||||
@@ -23,22 +24,22 @@ async def on_message(message):
|
||||
if message.content.startswith("!insult"):
|
||||
print(f'Message: {message.content}')
|
||||
l = message.content.split(" ")
|
||||
if (len(l) <= 1):
|
||||
return
|
||||
|
||||
id = 0
|
||||
target = message.author
|
||||
|
||||
if (len(l) > 1):
|
||||
# Associate given name with online discord target
|
||||
if (l[1].startswith("<@")):
|
||||
id = int(l[1][2:-1])
|
||||
print(f'{id}')
|
||||
target_id = int(l[1][2:-1])
|
||||
print(f'{target_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)}!'
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user