From abb9800f2eba106287a4ec36b15244c7a4a0edc4 Mon Sep 17 00:00:00 2001 From: HypoxiE Date: Sat, 26 Jul 2025 20:36:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=B0=D0=B7=D0=B0=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20=D1=81?= =?UTF-8?q?=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CoreSub.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 48 insertions(+) create mode 100644 README.md diff --git a/CoreSub.py b/CoreSub.py index e69de29..a4eee29 100644 --- a/CoreSub.py +++ b/CoreSub.py @@ -0,0 +1,47 @@ +import disnake +from disnake.ext import commands +import asyncio +import datetime +import sys + +from data.secrets.TOKEN import token + +class Bot(commands.Bot): + def __init__(self): + super().__init__( + command_prefix="=", + intents=disnake.Intents.all() + ) + self.shutdown_flag = asyncio.Event() + + async def on_ready(self): + self.krekchat = await self.fetch_guild(490445877903622144) + print(self.krekchat.name) + + await self.change_presence(status=disnake.Status.online, activity=disnake.Game("Работаю")) + print(f"{datetime.datetime.now().strftime('%H:%M:%S %d-%m-%Y')}:: KrekSupportBot activated") + + self.shutdown_flag.set() + +async def main(): + bot = Bot() + try: + bot_task = asyncio.create_task(bot.start(token)) + + await bot.shutdown_flag.wait() + + if not bot.is_closed(): + await bot.close() + + await bot_task + except KeyboardInterrupt: + if not bot.is_closed(): + await bot.close() + finally: + print("Программа завершена") + +if __name__ == "__main__": + try: + asyncio.run(main()) + except KeyboardInterrupt: + pass \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ddb4ec2 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +"# krekbot-support"