memed/bot/ext/rsudo.py
2017-12-02 11:24:55 -03:00

30 lines
670 B
Python

import logging
import discord
from .common import Cog
log = logging.getLogger(__name__)
class Rsudo(Cog):
def __init__(self, bot):
super().__init__(bot)
async def create_request(self, message):
# 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)
def setup(bot):
bot.add_cog(Rsudo(bot))