royalnet.bots¶
-
class
royalnet.bots.
TelegramBot
(*, telegram_config: royalnet.bots.telegram.TelegramConfig, royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None, database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None, command_prefix: str = '/', commands: List[Type[royalnet.utils.command.Command]] = None, missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>, error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>)¶ A bot that connects to Telegram.
-
__init__
(*, telegram_config: royalnet.bots.telegram.TelegramConfig, royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None, database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None, command_prefix: str = '/', commands: List[Type[royalnet.utils.command.Command]] = None, missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>, error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>)¶ Initialize self. See help(type(self)) for accurate signature.
-
_call_factory
() → Type[royalnet.utils.call.Call]¶ Create the Call class, representing a Call command. It should inherit from the utils.Call class.
-
_handle_update
(update: telegram.update.Update)¶
-
_init_client
()¶
-
botfather_command_string
¶
-
interface_name
= 'telegram'¶
-
run
()¶ A blocking coroutine that should make the bot start listening to commands and requests.
-
-
class
royalnet.bots.
TelegramConfig
(token: str)¶ The specific configuration to be used for royalnet.database.TelegramBot.
-
__init__
(token: str)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
royalnet.bots.
DiscordBot
(*, discord_config: royalnet.bots.discord.DiscordConfig, royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None, database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None, command_prefix: str = '!', commands: List[Type[royalnet.utils.command.Command]] = None, missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>, error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>)¶ A bot that connects to Discord.
-
__init__
(*, discord_config: royalnet.bots.discord.DiscordConfig, royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None, database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None, command_prefix: str = '!', commands: List[Type[royalnet.utils.command.Command]] = None, missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>, error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>)¶ Initialize self. See help(type(self)) for accurate signature.
-
_bot_factory
() → Type[discord.client.Client]¶ Create a new DiscordClient class based on this DiscordBot.
-
_call_factory
() → Type[royalnet.utils.call.Call]¶ Create the Call class, representing a Call command. It should inherit from the utils.Call class.
-
_init_client
()¶ Create a bot instance.
-
_init_voice
()¶
-
add_to_music_data
(audio_sources: List[discord.player.AudioSource], guild: discord.guild.Guild)¶ Add a file to the corresponding music_data object.
-
advance_music_data
(guild: discord.guild.Guild)¶ Try to play the next song, while it exists. Otherwise, just return.
-
interface_name
= 'discord'¶
-
run
()¶ A blocking coroutine that should make the bot start listening to commands and requests.
-
update_activity_with_source_title
(rpa: Optional[royalnet.audio.royalpcmaudio.RoyalPCMAudio] = None)¶
-
-
class
royalnet.bots.
DiscordConfig
(token: str)¶ The specific configuration to be used for royalnet.database.DiscordBot.
-
__init__
(token: str)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
royalnet.bots.
GenericBot
(*, royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None, database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None, command_prefix: str, commands: List[Type[royalnet.utils.command.Command]] = None, missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>, error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>)¶ A generic bot class, to be used as base for the other more specific classes, such as royalnet.bots.TelegramBot and royalnet.bots.DiscordBot.
-
__init__
(*, royalnet_config: Optional[royalnet.network.royalnetconfig.RoyalnetConfig] = None, database_config: Optional[royalnet.database.databaseconfig.DatabaseConfig] = None, command_prefix: str, commands: List[Type[royalnet.utils.command.Command]] = None, missing_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>, error_command: Type[royalnet.utils.command.Command] = <class 'royalnet.commands.null.NullCommand'>)¶ Initialize self. See help(type(self)) for accurate signature.
-
_call_factory
() → Type[royalnet.utils.call.Call]¶ Create the Call class, representing a Call command. It should inherit from the utils.Call class.
-
_init_commands
(command_prefix: str, commands: List[Type[royalnet.utils.command.Command]], missing_command: Type[royalnet.utils.command.Command], error_command: Type[royalnet.utils.command.Command])¶ Generate the commands dictionary required to handle incoming messages, and the network_handlers dictionary required to handle incoming requests.
-
_init_database
(commands: List[Type[royalnet.utils.command.Command]], database_config: royalnet.database.databaseconfig.DatabaseConfig)¶ Connect to the database, and create the missing tables required by the selected commands.
-
_init_royalnet
(royalnet_config: royalnet.network.royalnetconfig.RoyalnetConfig)¶ Create a RoyalnetLink, and run it as a task.
-
_network_handler
(message: royalnet.network.messages.Message) → royalnet.network.messages.Message¶ Handle a single Message received from the RoyalnetLink
-
call
(command_name: str, channel, parameters: List[str] = None, **kwargs)¶ Call a command by its string, or missing_command if it doesn’t exists, or error_command if an exception is raised during the execution.
-
interface_name
= NotImplemented¶
-
run
()¶ A blocking coroutine that should make the bot start listening to commands and requests.
-