add(command|sondage): start dev of command sondage
This commit is contained in:
parent
46b1daeae4
commit
8f17085cf7
3 changed files with 36 additions and 8 deletions
|
@ -79,3 +79,8 @@
|
||||||
- [x] getheaders
|
- [x] getheaders
|
||||||
- [x] git
|
- [x] git
|
||||||
- [x] quote
|
- [x] quote
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Cogs.sondage commands `(renamed as cogs.poll)`
|
||||||
|
- [ ] sondage (help?)
|
||||||
|
|
|
@ -295,11 +295,11 @@ class Admin(commands.Cog):
|
||||||
"""
|
"""
|
||||||
week_ago = datetime.datetime.now() - datetime.timedelta(weeks=6)
|
week_ago = datetime.datetime.now() - datetime.timedelta(weeks=6)
|
||||||
|
|
||||||
def check(payload: discord.RawReactionActionEvent):
|
def check(pld: discord.RawReactionActionEvent):
|
||||||
if payload.message_id != choice.id \
|
if pld.message_id != choice.id \
|
||||||
or payload.user_id != ctx.author.id:
|
or pld.user_id != ctx.author.id:
|
||||||
return False
|
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:
|
async with self.bot.db.acquire() as con:
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
@ -362,7 +362,8 @@ class Admin(commands.Cog):
|
||||||
|
|
||||||
await self.add_warn(ctx, member, reason)
|
await self.add_warn(ctx, member, reason)
|
||||||
await ctx.send(
|
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}`"
|
f"\n**{Texts('admin').get('Reason')}:** `{reason}`"
|
||||||
if reason != 'N/A' else ''
|
if reason != 'N/A' else ''
|
||||||
)
|
)
|
||||||
|
@ -392,8 +393,7 @@ class Admin(commands.Cog):
|
||||||
await ctx.send(embed=e)
|
await ctx.send(embed=e)
|
||||||
|
|
||||||
@_warn.command(name='edit', aliases=['change'])
|
@_warn.command(name='edit', aliases=['change'])
|
||||||
async def _warn_edit(self, ctx: commands.Context, warn_id: int, *,
|
async def _warn_edit(self, ctx: commands.Context, warn_id: int, *, reason):
|
||||||
reason):
|
|
||||||
query = """
|
query = """
|
||||||
UPDATE warns
|
UPDATE warns
|
||||||
SET reason = $2
|
SET reason = $2
|
||||||
|
@ -415,5 +415,6 @@ class Admin(commands.Cog):
|
||||||
todo: set lang for guild
|
todo: set lang for guild
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def setup(bot: TuxBot):
|
def setup(bot: TuxBot):
|
||||||
bot.add_cog(Admin(bot))
|
bot.add_cog(Admin(bot))
|
||||||
|
|
22
cogs/poll.py
Normal file
22
cogs/poll.py
Normal file
|
@ -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))
|
Loading…
Reference in a new issue