-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (28 loc) · 1.25 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import time
import datetime
import discord
import discord.ext.commands as commands
from dotenv import load_dotenv
from res.BotBase import Hanyasaka
from TranslationTracker_Slash import TranslationCog2, RecruitmentCog
load_dotenv()
if __name__ == "__main__":
class HanyasakaBotSetup(Hanyasaka):
async def setup_hook(self):
await super().setup_hook()
await self.add_cog(TranslationCog2(self))
await self.add_cog(RecruitmentCog(self))
bot = HanyasakaBotSetup()
# TODO Add error handling for insufficient permissions
@bot.after_invoke
async def after_invoke(ctx: commands.Context):
embed = discord.Embed(title="Command executed", colour=bot.base_color, url=ctx.message.jump_url, timestamp=datetime.datetime.utcnow().timetuple())
embed.add_field(name="Command", value=ctx.command.name)
embed.add_field(name="Author", value=ctx.author)
embed.add_field(name="Channel", value=f"{ctx.channel} in {ctx.guild}")
embed.add_field(name="Full command", value=ctx.message.content)
embed.set_thumbnail(url=ctx.author.avatar.url)
await bot.log_channel.send(embed=embed)
# TODO: Add error handling for MAL API functions
bot.run(os.getenv("Token"))