Skip to content

Instantly share code, notes, and snippets.

@PikalaxALT PikalaxALT/
Last active May 31, 2018

What would you like to do?
import asyncio
import discord
from discord.ext import commands
from collections import Counter
class FooCog:
THUMBS_UP = '\U0001ff4d'
THUMBS_DOWN = '\U0001ff4e'
def __init__(self, bot: commands.Bot): = bot
async def foo(self, ctx: commands.Context):
"""Group docs"""
async def bar(self, ctx: commands.Context):
"""Subcommand docs"""
msg: discord.Message = await ctx.send(f'Voting has begun: React with {self.THUMBS_UP} or {self.THUMBS_DOWN}')
await msg.add_reaction(self.THUMBS_UP)
await msg.add_reaction(self.THUMBS_DOWN)
await asyncio.sleep(120)
await msg.remove_reaction(self.THUMBS_UP)
await msg.remove_reaction(self.THUMBS_DOWN)
msg = await ctx.get_message(
votes = Counter({str(reaction.emoji): reaction.count for reaction in msg.reactions})
await ctx.send(f'Total votes:\n'
f'{self.THUMBS_UP}: {votes[self.THUMBS_UP]:d}\n'
f'{self.THUMBS_DOWN}: {votes[self.THUMBS_DOWN]:d}')
def setup(bot: commands.Bot):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.