From 8f17085cf79bcacbe3b4c212ae61b3865d87acfa Mon Sep 17 00:00:00 2001 From: Romain J Date: Sat, 28 Sep 2019 01:39:45 +0200 Subject: [PATCH] add(command|sondage): start dev of command sondage --- README.md | 7 ++++++- cogs/admin.py | 15 ++++++++------- cogs/poll.py | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 cogs/poll.py diff --git a/README.md b/README.md index 9816ca9..e6bb595 100644 --- a/README.md +++ b/README.md @@ -78,4 +78,9 @@ - [x] iplocalise - [x] getheaders - [x] git - - [x] quote \ No newline at end of file + - [x] quote + + --- + + # Cogs.sondage commands `(renamed as cogs.poll)` + - [ ] sondage (help?) diff --git a/cogs/admin.py b/cogs/admin.py index cc7c42f..7986cdc 100644 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -295,11 +295,11 @@ class Admin(commands.Cog): """ week_ago = datetime.datetime.now() - datetime.timedelta(weeks=6) - def check(payload: discord.RawReactionActionEvent): - if payload.message_id != choice.id \ - or payload.user_id != ctx.author.id: + def check(pld: discord.RawReactionActionEvent): + if pld.message_id != choice.id \ + or pld.user_id != ctx.author.id: return False - return payload.emoji.name in ('1⃣', '2⃣', '3⃣') + return pld.emoji.name in ('1⃣', '2⃣', '3⃣') async with self.bot.db.acquire() as con: await ctx.trigger_typing() @@ -362,7 +362,8 @@ class Admin(commands.Cog): await self.add_warn(ctx, member, reason) await ctx.send( - content=f"{member.mention} **{Texts('admin').get('got a warn')}**" + content=f"{member.mention} " + f"**{Texts('admin').get('got a warn')}**" f"\n**{Texts('admin').get('Reason')}:** `{reason}`" if reason != 'N/A' else '' ) @@ -392,8 +393,7 @@ class Admin(commands.Cog): await ctx.send(embed=e) @_warn.command(name='edit', aliases=['change']) - async def _warn_edit(self, ctx: commands.Context, warn_id: int, *, - reason): + async def _warn_edit(self, ctx: commands.Context, warn_id: int, *, reason): query = """ UPDATE warns SET reason = $2 @@ -415,5 +415,6 @@ class Admin(commands.Cog): todo: set lang for guild """ + def setup(bot: TuxBot): bot.add_cog(Admin(bot)) diff --git a/cogs/poll.py b/cogs/poll.py new file mode 100644 index 0000000..ac13044 --- /dev/null +++ b/cogs/poll.py @@ -0,0 +1,22 @@ +from discord.ext import commands + +from bot import TuxBot +from .utils.lang import Texts + + +class Poll(commands.Cog): + + def __init__(self, bot: TuxBot): + self.bot = bot + + """---------------------------------------------------------------------""" + + @commands.group(name='sondage', aliases=['poll']) + async def _poll(self, ctx): + """ + todo: refer to readme.md + """ + + +def setup(bot: TuxBot): + bot.add_cog(Poll(bot))