From 212e10d9a74cc17b832bdc78d4150c9226b67b5a Mon Sep 17 00:00:00 2001 From: Uwe Pfeifer Date: Wed, 7 May 2025 09:39:17 +0200 Subject: [PATCH] Add botprefix config option --- bot.ini.example | 6 +++++- pybot-f.py | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bot.ini.example b/bot.ini.example index ebc443f..52c3d2d 100644 --- a/bot.ini.example +++ b/bot.ini.example @@ -11,6 +11,10 @@ # try searching the internet for "How to create a Discord bot token" or # visit: https://discordpy.readthedocs.io/en/latest/discord.html # Also don't forget to invite the bot onto your server(s). +# +# - botprefix +# This is the prefix for commands when not using slash-commands. [General] -bottoken=BOTTOKEN_HERE \ No newline at end of file +bottoken=BOTTOKEN_HERE +botprefix=. diff --git a/pybot-f.py b/pybot-f.py index bee0bf2..ca639c0 100644 --- a/pybot-f.py +++ b/pybot-f.py @@ -11,9 +11,6 @@ from logging import handlers # Logging -#loghandler = logging.FileHandler(filename='bot.log', encoding='utf-8', mode='w') -#discord.utils.setup_logging(handler=loghandler) - logger = logging.getLogger('discord') logger.setLevel(logging.INFO) @@ -48,10 +45,11 @@ config.read('bot.ini') bottoken = config['General']['bottoken'] +botprefix = config['General']['botprefix'] # Setting up commands.Bot -bot = commands.Bot(command_prefix='.', description=description, intents=intents) +bot = commands.Bot(command_prefix=botprefix, description=description, intents=intents) @bot.event