the basics of rsudo

This commit is contained in:
Luna Mendes 2017-12-02 12:53:47 -03:00
parent d725403509
commit 49c4aa4e7b
4 changed files with 23 additions and 9 deletions

View file

@ -10,20 +10,28 @@ log = logging.getLogger(__name__)
class Rsudo(Cog):
def __init__(self, bot):
super().__init__(bot)
self.command_channel = None
async def create_request(self, message):
if not self.command_channel:
self.command_channel = self.bot.get_channel(
self.bot.config.command_channel)
if not self.command_channel:
log.warning('command channel not found')
return
# parse it, follows format command,uid
uid = message.split(',')[-1]
command = ','.join(message.split(',')[:-1])
log.info(f'[rsudo] {uid!r} {command!r}')
if not self.command_channel:
return
e = discord.Embed(title=f'rsudo from uid {uid}')
e.add_field(name='command', value=f'`{command}`')
await self.command_channel.send(embed=e)
m = await self.command_channel.send(embed=e)
await m.add_reaction('\N{WHITE HEAVY CHECK MARK}')
await m.add_reaction('\N{CROSS MARK}')
def setup(bot):