2023-05-02 16:46:15 +03:00
|
|
|
import logging
|
|
|
|
|
|
|
|
from discord import Activity, ActivityType
|
|
|
|
|
2023-05-06 18:56:33 +03:00
|
|
|
from cogs.admin import Admin
|
|
|
|
from cogs.analytics import Analytics
|
2023-05-04 17:09:47 +03:00
|
|
|
from cogs.custom_channels import CustomChannels
|
2023-05-06 18:56:33 +03:00
|
|
|
from cogs.data import Data
|
2023-05-06 18:08:35 +03:00
|
|
|
from cogs.logger import Logger
|
2023-05-06 19:56:01 +03:00
|
|
|
from modules.client import client
|
|
|
|
from modules.scheduled import scheduler
|
|
|
|
from modules.utils import config_get
|
|
|
|
from modules.utils_sync import config_get_sync
|
2023-05-02 16:46:15 +03:00
|
|
|
|
|
|
|
logging.basicConfig(
|
|
|
|
level=logging.INFO,
|
|
|
|
format="%(name)s.%(funcName)s | %(levelname)s | %(message)s",
|
|
|
|
datefmt="[%X]",
|
|
|
|
)
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
try:
|
2023-05-04 17:14:33 +03:00
|
|
|
import uvloop # type: ignore
|
2023-05-02 16:46:15 +03:00
|
|
|
|
|
|
|
uvloop.install()
|
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
@client.event
|
|
|
|
async def on_ready():
|
|
|
|
logger.info(f"Logged in as {client.user}")
|
2023-05-04 17:14:33 +03:00
|
|
|
await client.change_presence(
|
|
|
|
activity=Activity(type=ActivityType.listening, name=await config_get("status"))
|
|
|
|
)
|
|
|
|
|
2023-05-02 16:46:15 +03:00
|
|
|
|
|
|
|
def main():
|
2023-05-06 18:56:33 +03:00
|
|
|
client.add_cog(Admin(client))
|
|
|
|
client.add_cog(Analytics(client))
|
2023-05-04 17:09:47 +03:00
|
|
|
client.add_cog(CustomChannels(client))
|
2023-05-06 19:48:04 +03:00
|
|
|
client.add_cog(Data(client))
|
2023-05-06 18:08:35 +03:00
|
|
|
client.add_cog(Logger(client))
|
2023-05-04 17:09:47 +03:00
|
|
|
|
2023-05-02 16:46:15 +03:00
|
|
|
try:
|
|
|
|
scheduler.start()
|
2023-05-04 17:09:47 +03:00
|
|
|
client.run(config_get_sync("token"))
|
2023-05-02 16:46:15 +03:00
|
|
|
except KeyboardInterrupt:
|
|
|
|
scheduler.shutdown()
|
|
|
|
exit()
|
|
|
|
|
2023-05-04 17:14:33 +03:00
|
|
|
|
2023-05-02 16:46:15 +03:00
|
|
|
if __name__ == "__main__":
|
2023-05-04 17:14:33 +03:00
|
|
|
main()
|