From 0e07431c0222813d1115187d21c995f17e3a6ee0 Mon Sep 17 00:00:00 2001 From: Yusur Princeps Date: Thu, 1 Jan 2026 11:00:46 +0100 Subject: [PATCH] 0.1.0 initial commit --- .gitignore | 26 ++++++++++++++++++++ README.md | 3 +++ pyproject.toml | 17 +++++++++++++ src/yus26b/__init__.py | 55 ++++++++++++++++++++++++++++++++++++++++++ src/yus26b/__main__.py | 4 +++ 5 files changed, 105 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 pyproject.toml create mode 100644 src/yus26b/__init__.py create mode 100644 src/yus26b/__main__.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e2c6b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +node_modules/ +__pycache__/ +**.pyc +**.pyo +**.egg-info +**~ +.*.swp +\#*\# +.\#* +alembic.ini +.env +.env.* +.venv +env +venv +venv-*/ +config/ +conf/ +config.json +data/ +build/ +dist/ +/target +.err +.vscode +/run.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..5b98ffe --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Yusurland '26 Bot + +Bot of the Yusurland '26 Discord server. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..12b5a7b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,17 @@ +[project] +name = "sakuragasaki46_yus26b" +authors = [ { name = "Sakuragasaki46" } ] +dynamic = [ "version" ] +requires-python = ">=3.10" +classifiers = [ + "Private :: X" +] +dependencies = [ + "py-cord>=2.7.0", + "suou>=0.11.0", + "python-dotenv>=1.1.0" +] + +[tool.setuptools.dynamic] +version = { attr = "yus26b.__version__" } + diff --git a/src/yus26b/__init__.py b/src/yus26b/__init__.py new file mode 100644 index 0000000..094e8a7 --- /dev/null +++ b/src/yus26b/__init__.py @@ -0,0 +1,55 @@ +from suou import ConfigValue, ConfigOptions +import dotenv +import discord +import logging +import argparse + +__version__ = "0.1.0" + +dotenv.load_dotenv() + +class AppConfig(ConfigOptions): + token = ConfigValue(required=True) + client_id = ConfigValue(required=True) + +app_config = AppConfig() + +# TODO make it configurable +logging.basicConfig(level=logging.INFO) + +logger = logging.getLogger(__name__) + +bot = discord.Bot() + +bot.auto_sync_commands = False + +@bot.event +async def on_ready(): + logger.info(f"Logged in as {bot.user}") + +@bot.slash_command( + name = "version", + description = "Print bot's version." +) +async def version(ctx: discord.ApplicationContext): + await ctx.respond( + f""" +* **Bot Version**: {__version__} +* **Pycord Version**: {discord.__version__} + """.strip() + ) + +def make_parser(): + parser = argparse.ArgumentParser(description = "Yusurland '26's bot") + parser.add_argument('-v', '--version', action = 'version', version = __version__) + parser.add_argument('-s', '--sync', action='store_true', help="sync bot commands") + return parser + +def main(): + args = make_parser().parse_args() + + if args.sync: + logger.info('Syncing bot commands') + bot.auto_sync_commands = True + + bot.run(app_config.token) diff --git a/src/yus26b/__main__.py b/src/yus26b/__main__.py new file mode 100644 index 0000000..349750d --- /dev/null +++ b/src/yus26b/__main__.py @@ -0,0 +1,4 @@ + +from . import main + +main() \ No newline at end of file