add cogs
This commit is contained in:
36
cogs/admin.py
Normal file
36
cogs/admin.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import discord
|
||||||
|
from discord.ext import commands
|
||||||
|
import logging
|
||||||
|
|
||||||
|
e = discord.Embed()
|
||||||
|
|
||||||
|
# setup logging
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
logger = logging.getLogger('jeeves')
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
|
handler = logging.FileHandler(filename='jeeves.log', encoding='utf-8', mode='a')
|
||||||
|
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
|
||||||
|
logger.addHandler(handler)
|
||||||
|
|
||||||
|
|
||||||
|
class Admin(commands.Cog):
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, bot):
|
||||||
|
self.bot = bot
|
||||||
|
|
||||||
|
|
||||||
|
@commands.command()
|
||||||
|
@commands.is_owner()
|
||||||
|
async def clear(self, ctx, amount=1):
|
||||||
|
await ctx.channel.purge(limit=amount)
|
||||||
|
logger.warn(f'{ctx.message.author.name} cleared {amount} messages')
|
||||||
|
|
||||||
|
|
||||||
|
@commands.Cog.listener()
|
||||||
|
async def on_ready(self):
|
||||||
|
print('##### ADMIN module active')
|
||||||
|
|
||||||
|
|
||||||
|
def setup(bot):
|
||||||
|
bot.add_cog(Admin(bot))
|
||||||
@@ -30,7 +30,7 @@ class Games(commands.Cog):
|
|||||||
msg = f'Rolling %s for {ctx.message.author.mention}: `%s`'.format(roll) % (param,roll)
|
msg = f'Rolling %s for {ctx.message.author.mention}: `%s`'.format(roll) % (param,roll)
|
||||||
logline = f'Rolling %s for {ctx.message.author}: `%s`'.format(roll) % (param,roll)
|
logline = f'Rolling %s for {ctx.message.author}: `%s`'.format(roll) % (param,roll)
|
||||||
logger.info(logline)
|
logger.info(logline)
|
||||||
await ctx.message.channel.send(msg)
|
await ctx.send(msg)
|
||||||
|
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
|
|||||||
29
cogs/moderator.py
Normal file
29
cogs/moderator.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import discord
|
||||||
|
from discord.ext import commands
|
||||||
|
import logging
|
||||||
|
|
||||||
|
e = discord.Embed()
|
||||||
|
|
||||||
|
# setup logging
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
logger = logging.getLogger('jeeves')
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
|
handler = logging.FileHandler(filename='jeeves.log', encoding='utf-8', mode='a')
|
||||||
|
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
|
||||||
|
logger.addHandler(handler)
|
||||||
|
|
||||||
|
|
||||||
|
class Moderator(commands.Cog):
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, bot):
|
||||||
|
self.bot = bot
|
||||||
|
|
||||||
|
|
||||||
|
@commands.Cog.listener()
|
||||||
|
async def on_ready(self):
|
||||||
|
print('##### MODERATOR module active')
|
||||||
|
|
||||||
|
|
||||||
|
def setup(bot):
|
||||||
|
bot.add_cog(Moderator(bot))
|
||||||
Reference in New Issue
Block a user