Customization - LeConstellationniste/Discord.py-Framework- GitHub Wiki

Customization

An overview of the different settings used to customise your Bot, Commands, Listeners and Logs.

Bot

The following attributes can be used to customize your bot, they can be explained when creating the bot.

from discordEasy import Bot

my_bot = Bot(prefix=">", token=my_token_bot, print_traceback=True, send_errors=False, sep_args= " ")
Attribute Name Type Description Default value
prefix str The prefix of bot to call a command in Discord
description str The description for the bot. Use in the help default command ""
colour discord.Colour The color of bot. It's the color use for normal embeds. discord.Colour.blue()
coulour_error discord.Colour The color for embeds of error messages. discord.Coulour.red()
send_errors bool If True, the errors raised are send to the owner of application ([self.app_info.owner][AppInfo]). False
print_traceback bool If True, all traceback are displayed in console logs. True
sep_args str The separator of arguments in a command, use to extract arguments of a [Discord message][Message]. " "

Commands & Listners

The following attributes can be used to customize your bot, they can be explained when creating the bot.

from discordEasy.objects import Command, Listener

# Command
async def hello(message):
  await message.channel.send(f"Hello {message.author.mention}! 👋")

my_command = Command(hello, name="Hello", aliases=("Hi", "hi", "hello"), checks=[], admin=False, super_admin=False, white_list=[])

# Listener
async def on_ready_listener():
  print("ready!")

my_listener = Listener(on_ready_listener, event_name='on_ready', checks=[])

Command

Attribute Name Type Description Default value
name str The name of command use in Discord. _fct.__name__
aliases list[str] Aliases for command name use in Discord. []
description str The description for the command. Use in the help default command ""
checks list[function] A list of function wich return a boolean. The listener is executed only all checks return True []
delete_message bool If True, the message which call the command is delete after 3 secondes. False

Listener

Attribute Name Type Description Default value
event_name str The name of event which must be called. This name must be in the event reference list _fct.__name__
checks list[function] A list of function wich return a boolean. The listener is executed only all checks return True []

Logs

You can use the Logs class of the utils module to display logs with the date and the specified type. If colorama is installed you can also choose the colour.

Attributes Class Name colorama must be installed Description Default value
path_info NO The default path for logs info. None (logs are not save)
path_debug NO The default path for logs debug. None (logs are not save)
path_warning NO The default path for logs warning. None (logs are not save)
path_error NO The default path for logs error. None (logs are not save)
path_success NO The default path for logs success. None (logs are not save)
date_fmt NO The date format, see datetime format "%Y-%m-%d to %H:%M:%S"
color_debug YES The color use for debug logs colorama.Fore.CYAN
color_info YES The color use for info logs colorama.Fore.WHITE
color_warning YES The color use for warning logs colorama.Fore.YELLOW
color_error YES The color use for error logs colorama.Fore.RED
color_success YES The color use for success logs colorama.Fore.GREEN

To change a attribute class, use for example:

import colorama
from discordEasy.utils import Logs

Logs.color_debug = colorama.Fore.BLUE