refactor code to use cogs instead of loose functions

This commit is contained in:
2021-07-15 22:17:05 +02:00
parent 0395cd908d
commit 0e889261a0
5 changed files with 195 additions and 80 deletions

39
cogs/links.py Normal file
View File

@@ -0,0 +1,39 @@
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 Links(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def youtube(self, ctx):
await ctx.send('https://www.youtube.com/channel/UCTAnkjUOud_HdKhY_hi2ISA')
@commands.command()
async def donatie(self, ctx):
await ctx.send('<https://bunq.me/larpzomerfestival>')
@commands.Cog.listener()
async def on_ready(self):
print('##### LINKS module active')
def setup(bot):
bot.add_cog(Links(bot))