Compare commits
3 commits
d425b61755
...
4a5f85860e
Author | SHA1 | Date | |
---|---|---|---|
4a5f85860e | |||
9b1fd2f315 | |||
212e10d9a7 |
2 changed files with 18 additions and 5 deletions
|
@ -11,6 +11,12 @@
|
|||
# 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).
|
||||
#
|
||||
# - botprefixes
|
||||
# This is the prefix for commands when not using slash-commands.
|
||||
# Can also contain several prefixes, define it like: botprefixes=['!', '?','.']
|
||||
# (list of strings)
|
||||
|
||||
[General]
|
||||
bottoken=BOTTOKEN_HERE
|
||||
botprefixes=.
|
||||
|
|
15
pybot-f.py
15
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,20 @@ config.read('bot.ini')
|
|||
|
||||
|
||||
bottoken = config['General']['bottoken']
|
||||
botprefixes = config['General']['botprefixes']
|
||||
|
||||
|
||||
def get_prefixes(bot, message):
|
||||
"""
|
||||
For setting the bots prefixes in addition to mentions.
|
||||
"""
|
||||
|
||||
prefixes = botprefixes # Can be a list of strings
|
||||
return commands.when_mentioned_or(*prefixes)(bot, message)
|
||||
|
||||
|
||||
# Setting up commands.Bot
|
||||
bot = commands.Bot(command_prefix='.', description=description, intents=intents)
|
||||
bot = commands.Bot(command_prefix=get_prefixes, description=description, intents=intents)
|
||||
|
||||
|
||||
@bot.event
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue