memed/bot/ext/rsudo.py

31 lines
670 B
Python
Raw Normal View History

2017-12-02 14:24:55 +00:00
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))