diff --git a/.gitignore b/.gitignore index 5d381cc..5c43620 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,4 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +Christmas/config.json diff --git a/Christmas/Database/__init__.py b/Christmas/Database/__init__.py new file mode 100644 index 0000000..7c0d249 --- /dev/null +++ b/Christmas/Database/__init__.py @@ -0,0 +1,12 @@ +from motor.motor_asyncio import AsyncIOMotorClient + +from Christmas.config import ChristmasConfig + + + +class database(AsyncIOMotorClient): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.config = ChristmasConfig() + self.db = self( self.config.DATABASE["HOST"], self.config.DATABASE["PORT"], username=self.config.DATABASE["USERNAME"], password=self.config.DATABASE["PASSWORD"])[self.config.DATABASE["DATABASE"]] + \ No newline at end of file diff --git a/Christmas/__init__.py b/Christmas/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Christmas/__main__.py b/Christmas/__main__.py new file mode 100644 index 0000000..53da93d --- /dev/null +++ b/Christmas/__main__.py @@ -0,0 +1,18 @@ +from types import SimpleNamespace +from typing import Any, cast + +from discord import AutoShardedBot, Intents +from discord.ext import commands, tasks + +from Christmas.discord import Christmas + +if __name__ == "__main__": + bot = Christmas( + command_prefix=commands.when_mentioned_or("c!"), + case_insensitive=True, + allowed_mentions=commands.AllowedMentions( + everyone=False, users=True, roles=False, replied_user=True + ), + intents=Intents.all(), + ) + bot.run() \ No newline at end of file diff --git a/Christmas/config.py b/Christmas/config.py new file mode 100644 index 0000000..0261919 --- /dev/null +++ b/Christmas/config.py @@ -0,0 +1,30 @@ +import json + + +class ChristmasConfig: + def __init__(self): + self.json = json.load(open("Christmas/config.json", "r")) + + @property + def TOKEN(self): + return self.json["TOKEN"] + + @property + def PREFIX(self): + return self.json["PREFIX"] + + @property + def OWNER(self): + return self.json["OWNER"] + + @property + def LOG_CHANNEL(self): + return self.json["LOG_CHANNEL"] + + @property + def OWN_GUILD(self): + return self.json["OWN_GUILD"] + + @property + def DATABASE(self): + return self.json["DATABASE"] \ No newline at end of file diff --git a/Christmas/discord.py b/Christmas/discord.py new file mode 100644 index 0000000..15523b5 --- /dev/null +++ b/Christmas/discord.py @@ -0,0 +1,22 @@ +from types import SimpleNamespace +from typing import Any, cast + +from discord import AutoShardedBot +from discord.ext import commands, tasks + +from Christmas.config import ChristmasConfig + +class Christmas(AutoShardedBot): + def __init__(self, *args: Any, **kwargs: Any): + super().__init__(*args, **kwargs) + self.config = ChristmasConfig() + + def run(self, *args: Any, **kwargs: Any) -> None: + kwargs.update({"token": self.ctx.config.TOKEN}) + super().run(*args, **kwargs) + + + + + +