초기 커밋
This commit is contained in:
parent
622679c795
commit
cd79087626
1
.gitignore
vendored
1
.gitignore
vendored
@ -160,3 +160,4 @@ cython_debug/
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
Christmas/config.json
|
||||
|
12
Christmas/Database/__init__.py
Normal file
12
Christmas/Database/__init__.py
Normal file
@ -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"]]
|
||||
|
0
Christmas/__init__.py
Normal file
0
Christmas/__init__.py
Normal file
18
Christmas/__main__.py
Normal file
18
Christmas/__main__.py
Normal file
@ -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()
|
30
Christmas/config.py
Normal file
30
Christmas/config.py
Normal file
@ -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"]
|
22
Christmas/discord.py
Normal file
22
Christmas/discord.py
Normal file
@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user