discord_lfg.input_config
Process configs for the bot.
logger = logging.getLogger(__name__)
module-attribute
#
CommandArgument(name, python_type, required, description, autocomplete_options, autocomplete_channel_numbers=False, display_name='')
dataclass
#
For storage of parameters and creation of discord.app_command.Command arguments.
as_parameter
property
#
Gets the definition of an argument for a function.
More specifically, this uses the inspect.Parameter functionality to programmatically
define what the argument should look like.
e.g. if you had a function defined like this:
def func(name_arg: str, detail_info: dict):
the two arguments would look like this:
name_arg = inspect.Parameter(
name="name_arg",
kind=inspect.Parameter.POSITIONAL_OR_KEYWORD,
annotation=str,
default=inspect.Parameter.empty
)
detail_info = inspect.Parameter(
name="detail_info",
kind=inspect.Parameter.POSITIONAL_OR_KEYWORD,
annotation=dict,
default=inspect.Parameter.empty
)
func.__signature__ and inspect.Signature.
autocomplete_channel_numbers = False
class-attribute
instance-attribute
#
autocomplete_options
instance-attribute
#
description
instance-attribute
#
display_name = ''
class-attribute
instance-attribute
#
displayed_name
property
#
Gets the name that is displayed to discord users.
name
instance-attribute
#
python_type
instance-attribute
#
required
instance-attribute
#
discord_autocomplete(command)
#
Applies an autocompleter for a discord command that has had this parameter added.
Note that just because an argument has an autocomplete set, discord does not enforce the
autocomplete values. See _autocomplete_validator.
Source code in src\discord_lfg\input_config.py
discord_description(command)
#
Applies a description for a discord command that has had this parameter added.
discord_rename(command)
#
Renames how discord displays the name of this command.
This will make it so that although Python thinks the argument is named one thing, the name displayed to the user when they use the slash command is something different. This makes it possible to have a generalised function, but make it so that discord displays a customised name to the user.
Source code in src\discord_lfg\input_config.py
validate()
#
Validates that the argument elements are acceptable.
Source code in src\discord_lfg\input_config.py
CommandConfig(args, roles, name, description, debug, guild_name, timeout_length, editable_length, kick_reasons, channel_whitelist, channel_role_mentions, guild_roles)
dataclass
#
Configuration for individual command.
args
instance-attribute
#
channel_role_mentions
instance-attribute
#
channel_whitelist
instance-attribute
#
debug
instance-attribute
#
description
instance-attribute
#
editable_length
instance-attribute
#
guild_name
instance-attribute
#
guild_roles
instance-attribute
#
kick_reasons
instance-attribute
#
name
instance-attribute
#
roles
instance-attribute
#
timeout_length
instance-attribute
#
validate()
#
Validates the config inputs.
Source code in src\discord_lfg\input_config.py
ConfigValueError(messages)
#
LFGConfig(debug, guild_id_int, guild_id_discord, guild_name, moderator_role_name, log_folder, stats_folder, all_roles, commands)
dataclass
#
Configuration for LFG bot.
all_roles
instance-attribute
#
commands
instance-attribute
#
debug
instance-attribute
#
guild_id_discord
instance-attribute
#
guild_id_int
instance-attribute
#
guild_name
instance-attribute
#
log_folder
instance-attribute
#
moderator_role_name
instance-attribute
#
stats_folder
instance-attribute
#
validate()
#
Validates the config inputs.
Source code in src\discord_lfg\input_config.py
command_argument_from_config(argument_definition, arg_name)
#
Builds a command argument based on information given in a toml config.
Source code in src\discord_lfg\input_config.py
parse_inputs()
#
Parse the inputs to the bot.py script.
setup_logging(log_folder, debug=False)
#
Setup logger.