Select Git revision
-
heineke.pb authoredheineke.pb authored
bot.py 2.19 KiB
# bot.py
import asyncio
import os
import random
import sys
import subprocess
import discord
from discord.ext import commands
from discord.ext import tasks
from dotenv import load_dotenv
from datetime import datetime
#IMPORTS Discord..............END
#IMPORTS Else.................END
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')
intents = discord.Intents.default()
intents.all()
intents.members = True
intents.message_content = True
owners = [417073119254282240, 386254372646158338]
bot = commands.Bot(command_prefix = ["~"], owner_ids = set(owners), intents=intents, help_command=None)
#BOTEVENTS
@bot.event
async def on_ready():
print(f'{"-" * 50}\nConnected Bot: {bot.user.name}\n{"-" * 50}')
await bot.load_extension("modules.RPGLoader")
#####
@bot.command()
async def help(ctx):
for cog in bot.cogs.values():
if isinstance(cog, commands.Cog):
commands_list = cog.get_commands()
if commands_list:
cog_name = cog.qualified_name if cog.qualified_name else "No Category"
command_info = []
for command in commands_list:
short_description = command.brief or "Keine kurze Beschreibung verfügbar."
command_info.append(f"`{command.name}` - {short_description}\n")
await ctx.send(command_info)
@commands.is_owner()
@bot.command(aliases=["l"])
async def load(ctx, extension):
#####load side
try:
await bot.load_extension(f'modules.{extension}')
await ctx.send(f"{extension} loaded")
except Exception as d:
await ctx.send(f'{d}')
'''Bot kann heruntergefahren werden.'''
@bot.command()
@commands.is_owner()
async def shutdown(ctx):
await ctx.send('Shutting down...')
print('Shutting down...')
await bot.close()
@bot.command(aliases=["f"])
async def freeze(ctx):
loaded_cogs = [cog for cog in bot.cogs.keys()]
if loaded_cogs:
await ctx.send(f'Loaded cogs: {", ".join(loaded_cogs)}')
else:
await ctx.send('No cogs loaded.')
@bot.hybrid_command(name='test', with_app_command=True)
async def test(ctx):
await ctx.send("This is a hybrid command!")
#BOT >>RUN
bot.run(TOKEN)
#