1
0
Fork 0
mirror of synced 2024-06-03 11:14:33 +12:00

Correct int/str conversion

This commit is contained in:
phxntxm 2017-03-08 14:04:16 -06:00
parent 1a2a1f070c
commit 4e09b7a737

View file

@ -34,7 +34,7 @@ class Raffle:
return return
for raffle in raffles: for raffle in raffles:
server = self.bot.get_guild(raffle['server_id']) server = self.bot.get_guild(int(raffle['server_id']))
# Check to see if this cog can find the server in question # Check to see if this cog can find the server in question
if server is None: if server is None:
@ -58,13 +58,13 @@ class Raffle:
winner = None winner = None
count = 0 count = 0
while winner is None: while winner is None:
winner = server.get_member(random.SystemRandom().choice(entrants)) winner = server.get_member(int(random.SystemRandom().choice(entrants)))
# Lets make sure we don't get caught in an infinite loop # Lets make sure we don't get caught in an infinite loop
# Realistically having more than 25 random entrants found that aren't in the server anymore # Realistically having more than 50 random entrants found that aren't in the server anymore
# Isn't something that should be an issue # Isn't something that should be an issue, but better safe than sorry
count += 1 count += 1
if count >= 25: if count >= 50:
break break
if winner is None: if winner is None:
@ -75,8 +75,12 @@ class Raffle:
# No matter which one of these matches were met, the raffle has ended and we want to remove it # No matter which one of these matches were met, the raffle has ended and we want to remove it
# We don't have to wait for it however, so create a task for it # We don't have to wait for it however, so create a task for it
self.bot.loop.create_task(utils.remove_content('raffles', raffle_id)) self.bot.loop.create_task(utils.remove_content('raffles', raffle_id))
server_settings = await utils.get_content('server_settings', str(server.id))
channel_id = server_settings.get('notification_channel', server.id)
channel = self.bot.get_channel(channel_id)
try: try:
await server.send(fmt) await channel.send(fmt)
except discord.Forbidden: except discord.Forbidden:
pass pass