Skip to content

Instantly share code, notes, and snippets.

@ar00n
Last active March 3, 2018 03:51
Show Gist options
  • Save ar00n/d4eede61fdb97eafbb5ffa042867c453 to your computer and use it in GitHub Desktop.
Save ar00n/d4eede61fdb97eafbb5ffa042867c453 to your computer and use it in GitHub Desktop.
import discord
from discord.ext import commands
from discord.ext.commands import Bot
from secrets import choice
from asyncio import sleep
import asyncio
bot = commands.Bot(command_prefix=[','])
@bot.event
async def on_ready():
print(bot.user.name + ' is ready')
@bot.command(pass_context=True)
async def winner(ctx, interval: int, time: int):
if str(ctx.message.author.id) in ['418193802151329793', '231715673435275274']:
a = 0
time = time*60
interval = interval*60
times = time / interval
while a < times:
members = ctx.message.server.members
while True:
win = choice(list(members))
if str(win.status) == 'offline':
#print('skipped ' + str(win))
None
elif str(win.top_role) in ['CEO', 'COO', 'VPs', 'Bankers', 'GarliCoin Bank Bots']:
None
#print('skipped ' + str(win) + ' in role ' + str(win.top_role))
else:
await bot.say('Congratulations {}! You have won 2 GRLC! <:garlicoin:419179538644336643> Contact <@418193802151329793> with your garlicoin address to receive winnings.'.format(win.mention))
await sleep(interval)
break
a += 1
a = 0
bot.run('key')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment