diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7cfbfbf --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.env +*.pyc +*.pyd +poetry.lock \ No newline at end of file diff --git a/bot.py b/bot.py new file mode 100644 index 0000000..4d7f923 --- /dev/null +++ b/bot.py @@ -0,0 +1,72 @@ +import random +import os +import platform +import sys +import discord +from discord.ext import commands +from discord import app_commands +from dotenv import load_dotenv + +if sys.platform == "Linux": + import uvloop +else: + import winloop + +load_dotenv() +TOKEN = os.getenv("TOKEN") + +description = """haunter""" + +intents = discord.Intents.all() +intents.members = True +intents.message_content = True + + +bot = commands.Bot(command_prefix="?", description=description, intents=intents) + + +libs = [ + "jishaku", +] + + +@bot.event +async def on_ready(): + + 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") + + 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("------") + + +@bot.command() +async def joined(ctx, member: discord.Member): + """Says when a member joined.""" + await ctx.send(f"{member.name} joined {discord.utils.format_dt(member.joined_at)}") + + +@bot.group() +async def cool(ctx): + if ctx.invoked_subcommand is None: + await ctx.send(f"No, {ctx.subcommand_passed} is not cool") + + +@bot.hybrid_command(name="first_slash") +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) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..87e7630 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[project] +name = "haunter" +version = "0.1.0" +description = "admin bot" +authors = [ + {name = "Your Name",email = "you@example.com"} +] +license = {text = "MPL"} +readme = "README.md" +requires-python = ">=3.12" +dependencies = [ + "discord (>=2.3.2,<3.0.0)", + "jishaku (>=2.6.0,<3.0.0)", + "winloop (>=0.1.8,<0.2.0) ; sys_platform == \"win32\"", + "uvloop (>=0.21.0,<0.22.0) ; sys_platform == \"linux\"", + "python-dotenv (>=1.1.0,<2.0.0)", +] + + +[build-system] +requires = ["poetry-core>=2.0.0,<3.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +package-mode = false \ No newline at end of file