the hell is going on bro

This commit is contained in:
C committed 2025-04-01 12:15:25 -07:00
1 parent b910c71bfe
commit 8ce5412f9d
3 files changed
+158 -21

No files matched your search

+41 -21
View File
@@ -1,7 +1,10 @@
import asyncio
import random
import os
import platform
import sys
import traceback
import discord
from discord.ext import commands
from discord import app_commands
@@ -21,30 +24,52 @@ intents = discord.Intents.all()
intents.members = True
intents.message_content = True
bot = commands.Bot(command_prefix="?", description=description, intents=intents)
libs = [
"jishaku",
"lib.mod",
]
def get_prefix(bot, message):
@bot.event
async def on_ready():
prefixes = ["?"]
return commands.when_mentioned_or(*prefixes)(bot, message)
for lib in libs:
await bot.load_extension(lib)
print(f"\n[^] Loaded {len(libs)} extensions loaded successfully.")
# for guild in bot.guilds:
# await bot.tree.sync(guild=discord.Object(id=guild.id))
# print(f"[^] Sync'd application commands to {len(bot.guilds)} servers")
class Bot(commands.Bot):
print(f"[*] Logged in as {bot.user} (ID: {bot.user.id})")
game = discord.Game(name="https://traps.moe",activity=random.randint(0,3))
await bot.change_presence(status=discord.Status.online,activity=game)
print("------")
async def on_ready(self):
for lib in libs:
try:
bot.load_extension(lib)
except Exception as e:
print(f'[!] Failed to load extension: {lib}')
traceback.print_exc()
finally:
print(f"\n[^] Loaded {len(libs)} extensions loaded successfully.")
# for guild in bot.guilds:
# await bot.tree.sync(guild=discord.Object(id=guild.id))
# print(f"[^] Sync'd application commands to {len(bot.guilds)} servers")
print(f"[*] Logged in as {bot.user} (ID: {bot.user.id})")
game = discord.Game(name="https://traps.moe", activity=random.randint(0, 3))
await bot.change_presence(status=discord.Status.online, activity=game)
print("------")
if sys.platform == "Linux":
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
loop = asyncio.get_event_loop()
else:
asyncio.set_event_loop_policy(winloop.EventLoopPolicy())
loop = asyncio.get_event_loop()
bot = Bot(
command_prefix=get_prefix,
description=description,
intents=intents,
loop=loop,
)
@bot.command()
@@ -64,9 +89,4 @@ async def first_slash(ctx):
await ctx.send("You executed the slash command!")
if sys.platform == "Linux":
uvloop.install()
else:
winloop.install()
bot.run(TOKEN)