Files
brahmos/botclass.py
T
2024-03-02 21:07:44 +05:30

48 lines
1.2 KiB
Python

import base64
import json
import os
from typing import List, Literal, Optional, Union
import aiohttp
import discord
import jishaku
from discord.ext.commands import Bot, Context
OWNER = [407135783678640128, 341958485724102668]
class CustomCtx(Context):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.session = aiohttp.ClientSession(loop=self.bot.loop)
class Brahmos(Bot):
"""
Custom bot class
"""
def __init__(self, **kwargs):
kwargs["command_prefix"] = ["fr "]
super().__init__(**kwargs, help_command=None)
self.exts = [i[:-3] for i in os.listdir("exts") if i.endswith(".py")]
self.name = "brahmos"
async def is_owner(self, user: discord.user):
if user.id in OWNER:
return True
return False
async def setup_hook(self):
print(f"logged in as: {self.user.name}")
await self.load_extension("jishaku")
for ext in self.exts:
await self.load_extension(f"exts.{ext}")
async def get_context(self, message, *, cls=CustomCtx):
return await super().get_context(message, cls=cls)
def update_exts(self):
self.exts = [i[:-3] for i in os.listdir("exts") if i.endswith(".py")]