def start(self): self.db.exec( "CREATE TABLE IF NOT EXISTS discord_char_link (discord_id BIGINT NOT NULL, char_id INT NOT NULL)" ) self.message_hub_service.register_message_destination( self.MESSAGE_SOURCE, self.handle_incoming_relay_message, [ "private_channel", "org_channel", "websocket_relay", "tell_relay", "shutdown_notice" ], [self.MESSAGE_SOURCE]) self.register_discord_command_handler( self.discord_link_cmd, "discord", [Const("link"), Character("ao_character")]) self.register_discord_command_handler(self.discord_unlink_cmd, "discord", [Const("unlink")]) self.ts.register_translation("module/discord", self.load_discord_msg) self.setting_service.register(self.module_name, "discord_enabled", False, BooleanSettingType(), "Enable the Discord relay") self.setting_service.register(self.module_name, "discord_bot_token", "", HiddenSettingType(allow_empty=True), "Discord bot token") self.setting_service.register( self.module_name, "discord_channel_id", "", TextSettingType(allow_empty=True), "Discord channel id for relaying messages to and from", "You can get the Discord channel ID by right-clicking on a channel name in Discord and then clicking \"Copy ID\"" ) self.setting_service.register(self.module_name, "discord_embed_color", "#00FF00", ColorSettingType(), "Discord embedded message color") self.setting_service.register( self.module_name, "relay_color_prefix", "#FCA712", ColorSettingType(), "Set the prefix color for messages coming from Discord") self.setting_service.register( self.module_name, "relay_color_name", "#808080", ColorSettingType(), "Set the color of the name for messages coming from Discord") self.setting_service.register( self.module_name, "relay_color_message", "#00DE42", ColorSettingType(), "Set the color of the content for messages coming from Discord") self.setting_service.register_change_listener( "discord_channel_id", self.update_discord_channel) self.setting_service.register_change_listener( "discord_enabled", self.update_discord_state)
def start(self): self.setting_service.register_new("core.system", "symbol", "!", TextSettingType(["!", "#", "*", "@", "$", "+", "-"]), "Symbol for executing bot commands") self.setting_service.register_new("core.system", "org_channel_max_page_length", 7500, NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "Maximum size of blobs in org channel") self.setting_service.register_new("core.system", "private_message_max_page_length", 7500, NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "Maximum size of blobs in private messages") self.setting_service.register_new("core.system", "private_channel_max_page_length", 7500, NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "Maximum size of blobs in private channel") self.setting_service.register_new("core.system", "org_id", "", NumberSettingType(allow_empty=True), "Override the default org id", "This setting is is for development/debug purposes and should not be changed unless you understand the implications") self.setting_service.register_new("core.system", "org_name", "", TextSettingType(allow_empty=True), "The exact org name of the bot", "This setting is automatically set by the bot and should not be changed manually") self.setting_service.register_new("core.colors", "header_color", "#FFFF00", ColorSettingType(), "Color for headers") self.setting_service.register_new("core.colors", "header2_color", "#FCA712", ColorSettingType(), "Color for sub-headers") self.setting_service.register_new("core.colors", "highlight_color", "#00BFFF", ColorSettingType(), "Color for highlight") self.setting_service.register_new("core.colors", "notice_color", "#FF8C00", ColorSettingType(), "Color for important notices") self.setting_service.register_new("core.colors", "neutral_color", "#E6E1A6", ColorSettingType(), "Color for neutral faction") self.setting_service.register_new("core.colors", "omni_color", "#FA8484", ColorSettingType(), "Color for omni faction") self.setting_service.register_new("core.colors", "clan_color", "#F79410", ColorSettingType(), "Color for clan faction") self.setting_service.register_new("core.colors", "unknown_color", "#FF0000", ColorSettingType(), "Color for unknown faction") self.setting_service.register_new("core.colors", "org_channel_color", "#89D2E8", ColorSettingType(), "Default org channel color") self.setting_service.register_new("core.colors", "private_channel_color", "#89D2E8", ColorSettingType(), "Default private channel color") self.setting_service.register_new("core.colors", "private_message_color", "#89D2E8", ColorSettingType(), "Default private message color") self.setting_service.register_new("core.colors", "blob_color", "#FFFFFF", ColorSettingType(), "Default blob content color") self.register_packet_handler(server_packets.PrivateMessage.id, self.handle_private_message, priority=40)
def start(self): self.setting_service.register( "arelay_symbol", "#", "Symbol for external relay", TextSettingType(["!", "#", "*", "@", "$", "+", "-"]), "custom.arelay") self.setting_service.register( "arelay_symbol_method", "with_symbol", "When to relay messages", TextSettingType(["Always", "with_symbol", "unless_symbol"]), "custom.arelay") self.setting_service.register("arelaybot", "", "Bot for alliance relay", TextSettingType([]), "custom.arelay") self.setting_service.register("arelay_enabled", False, "Enable the alliance relay", BooleanSettingType(), "custom.arelay") self.setting_service.register("arelay_guild_abbreviation", "", "Abbreviation to use for org name", TextSettingType([]), "custom.arelay") self.setting_service.register("arelay_color", "#C3C3C3", "Color of messages from relay", ColorSettingType(), "custom.arelay") self.message_hub_service.register_message_source( self.MESSAGE_SOURCE, self.handle_relay_hub_message) self.bot.add_packet_handler(server_packets.PrivateChannelInvited.id, self.handle_private_channel_invite, 100) self.bot.add_packet_handler(server_packets.PrivateChannelMessage.id, self.handle_private_channel_message)
def start(self): self.message_hub_service.register_message_destination( self.MESSAGE_SOURCE, self.handle_message_from_hub, ["private_channel", "org_channel", "discord", "tell_relay"], [self.MESSAGE_SOURCE]) self.setting_service.register(self.module_name, "websocket_relay_enabled", False, BooleanSettingType(), "Enable the websocket relay") self.setting_service.register( self.module_name, "websocket_relay_server_address", "ws://localhost/subscribe/relay", TextSettingType([ "ws://localhost/subscribe/relay", "wss://relay.jkbff.com/subscribe/relay" ]), "The address of the websocket relay server", "All bots on the relay must connect to the same server and channel. If using the public relay server, use a unique channel name. " "Example: ws://relay.jkbff.com/subscribe/unique123 (<highlight>relay.jkbff.com</highlight> is the server and <highlight>unique123</highlight> is the channel)" ) self.setting_service.register( self.module_name, "websocket_relay_channel_color", "#FFFF00", ColorSettingType(), "Color of the channel in websocket relay messages") self.setting_service.register( self.module_name, "websocket_relay_message_color", "#FCA712", ColorSettingType(), "Color of the message content in websocket relay messages") self.setting_service.register( self.module_name, "websocket_relay_sender_color", "#00DE42", ColorSettingType(), "Color of the sender in websocket relay messages") self.setting_service.register( self.module_name, "websocket_encryption_key", "", HiddenSettingType(allow_empty=True), "An encryption key used to encrypt messages over a public websocket relay" ) self.initialize_encrypter( self.setting_service.get("websocket_encryption_key").get_value()) self.setting_service.register_change_listener( "websocket_relay_enabled", self.websocket_relay_update) self.setting_service.register_change_listener( "websocket_relay_server_address", self.websocket_relay_update) self.setting_service.register_change_listener( "websocket_encryption_key", self.websocket_relay_update)
def start(self): self.command_alias_service.add_alias("leaderecho", "leader echo") self.setting_service.register_new( self.module_name, "leader_echo_color", "#00FF00", ColorSettingType(), "Color with which the leader's messages will be echoed with") self.setting_service.register_new( self.module_name, "leader_auto_echo", False, BooleanSettingType(), "If turned on, when someone assume the leader role, leader echo will automatically be activated for said person" )
def start(self): self.setting_manager.register( "org_channel_max_page_length", 7500, "Maximum size of blobs in org channel", NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "core.system") self.setting_manager.register( "private_message_max_page_length", 7500, "Maximum size of blobs in private messages", NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "core.system", ) self.setting_manager.register( "private_channel_max_page_length", 7500, "Maximum size of blobs in private channel", NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "core.system") self.setting_manager.register("header_color", "#FFFF00", "color for headers", ColorSettingType(), "core.colors") self.setting_manager.register("header2_color", "#FCA712", "color for sub-headers", ColorSettingType(), "core.colors") self.setting_manager.register("highlight_color", "#FFFFFF", "color for highlight", ColorSettingType(), "core.colors") self.setting_manager.register("neutral_color", "#E6E1A6", "color for neutral faction", ColorSettingType(), "core.colors") self.setting_manager.register("omni_color", "#FA8484", "color for omni faction", ColorSettingType(), "core.colors") self.setting_manager.register("clan_color", "#F79410", "color for clan faction", ColorSettingType(), "core.colors") self.setting_manager.register("unknown_color", "#FF0000", "color for unknown faction", ColorSettingType(), "core.colors") self.setting_manager.register("notice_color", "#FF8C00", "color for important notices", ColorSettingType(), "core.colors") self.setting_manager.register( "symbol", "!", "Symbol for executing bot commands", TextSettingType(["!", "#", "*", "@", "$", "+", "-"]), "core.system")
def start(self): self.setting_service.register( self.module_name, "arelay_symbol", "@", TextSettingType(["!", "#", "*", "@", "$", "+", "-"]), "Symbol for external relay") self.setting_service.register( self.module_name, "arelay_symbol_method", "with_symbol", TextSettingType(["Always", "with_symbol", "unless_symbol"]), "When to relay messages") self.setting_service.register(self.module_name, "arelay_bot", "", TextSettingType(allow_empty=True), "Bot for alliance relay") self.setting_service.register(self.module_name, "arelay_enabled", False, BooleanSettingType(), "Enable the alliance relay") self.setting_service.register(self.module_name, "arelay_guild_abbreviation", "", TextSettingType(allow_empty=True), "Abbreviation to use for org name") self.setting_service.register(self.module_name, "arelay_color", "#C3C3C3", ColorSettingType(), "Color of messages from relay") self.setting_service.register( self.module_name, "arelay_command_prefix", "!agcr", TextSettingType(["!agcr", "gcr", "grc"]), "Command prefix to use when sending and receiving messages") self.message_hub_service.register_message_destination( self.MESSAGE_SOURCE, self.handle_relay_hub_message, [ "org_channel", "org_channel_update", "private_channel", "private_channel_update", "discord" ], [self.MESSAGE_SOURCE]) self.bot.register_packet_handler( server_packets.PrivateChannelInvited.id, self.handle_private_channel_invite, 100) self.bot.register_packet_handler( server_packets.PrivateChannelMessage.id, self.handle_private_channel_message)
def websocket_sender_color(self): return ColorSettingType()
def websocket_message_color(self): return ColorSettingType()
def websocket_channel_color(self): return ColorSettingType()
def discord_embed_color(self): return ColorSettingType()
def relay_color_message(self): return ColorSettingType()
def sticky_color(self): return ColorSettingType()
def start(self): self.setting_service.register( "symbol", "!", "Symbol for executing bot commands", TextSettingType(["!", "#", "*", "@", "$", "+", "-"]), "core.system") self.setting_service.register( "org_channel_max_page_length", 7500, "Maximum size of blobs in org channel", NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "core.system") self.setting_service.register( "private_message_max_page_length", 7500, "Maximum size of blobs in private messages", NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "core.system", ) self.setting_service.register( "private_channel_max_page_length", 7500, "Maximum size of blobs in private channel", NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "core.system") self.setting_service.register("header_color", "#FFFF00", "color for headers", ColorSettingType(), "core.colors") self.setting_service.register("header2_color", "#FCA712", "color for sub-headers", ColorSettingType(), "core.colors") self.setting_service.register("highlight_color", "#00BFFF", "color for highlight", ColorSettingType(), "core.colors") self.setting_service.register("notice_color", "#FF8C00", "color for important notices", ColorSettingType(), "core.colors") self.setting_service.register("neutral_color", "#E6E1A6", "color for neutral faction", ColorSettingType(), "core.colors") self.setting_service.register("omni_color", "#FA8484", "color for omni faction", ColorSettingType(), "core.colors") self.setting_service.register("clan_color", "#F79410", "color for clan faction", ColorSettingType(), "core.colors") self.setting_service.register("unknown_color", "#FF0000", "color for unknown faction", ColorSettingType(), "core.colors") self.setting_service.register("org_channel_color", "#89D2E8", "default org channel color", ColorSettingType(), "core.colors") self.setting_service.register("private_channel_color", "#89D2E8", "default private channel color", ColorSettingType(), "core.colors") self.setting_service.register("private_message_color", "#89D2E8", "default private message color", ColorSettingType(), "core.colors") self.setting_service.register("blob_color", "#FFFFFF", "default blob content color", ColorSettingType(), "core.colors") self.add_packet_handler(server_packets.PrivateMessage.id, self.handle_private_message, priority=40)
def start(self): self.setting_service.register( "core.system", "symbol", "!", TextSettingType(["!", "#", "*", "@", "$", "+", "-"]), "Symbol for executing bot commands") self.setting_service.register( "core.system", "org_channel_max_page_length", 7500, NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "Maximum size of blobs in org channel") self.setting_service.register( "core.system", "private_message_max_page_length", 7500, NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "Maximum size of blobs in private messages") self.setting_service.register( "core.system", "private_channel_max_page_length", 7500, NumberSettingType([4500, 6000, 7500, 9000, 10500, 12000]), "Maximum size of blobs in private channel") self.setting_service.register( "core.system", "accept_commands_from_slave_bots", False, BooleanSettingType(), "Accept and respond to commands sent to slave bots (only applies if you have added slave bots in the config)" ) self.setting_service.register("core.colors", "header_color", "#FFFF00", ColorSettingType(), "Color for headers") self.setting_service.register("core.colors", "header2_color", "#FCA712", ColorSettingType(), "Color for sub-headers") self.setting_service.register("core.colors", "highlight_color", "#00BFFF", ColorSettingType(), "Color for highlight") self.setting_service.register("core.colors", "notice_color", "#FF8C00", ColorSettingType(), "Color for important notices") self.setting_service.register("core.colors", "neutral_color", "#E6E1A6", ColorSettingType(), "Color for neutral faction") self.setting_service.register("core.colors", "omni_color", "#FA8484", ColorSettingType(), "Color for omni faction") self.setting_service.register("core.colors", "clan_color", "#F79410", ColorSettingType(), "Color for clan faction") self.setting_service.register("core.colors", "unknown_color", "#FF0000", ColorSettingType(), "Color for unknown faction") self.setting_service.register("core.colors", "org_channel_color", "#89D2E8", ColorSettingType(), "Default org channel color") self.setting_service.register("core.colors", "private_channel_color", "#89D2E8", ColorSettingType(), "Default private channel color") self.setting_service.register("core.colors", "private_message_color", "#89D2E8", ColorSettingType(), "Default private message color") self.setting_service.register("core.colors", "blob_color", "#FFFFFF", ColorSettingType(), "Default blob content color") self.register_packet_handler(server_packets.PrivateMessage.id, self.handle_private_message, priority=40)
def gridnet_sender_color(self): return ColorSettingType()
def gridnet_message_color(self): return ColorSettingType()
def gridnet_channel_color(self): return ColorSettingType()
def start(self): self.message_hub_service.register_message_destination( self.MESSAGE_SOURCE, self.handle_message_from_hub, [ "private_channel", "private_channel_update", "org_channel", "org_channel_update", "discord" ], [self.MESSAGE_SOURCE]) self.setting_service.register( self.module_name, "relay_prefix", "", TextSettingType(allow_empty=True), "Name of this relay (if you don't want to use org or bot name)") self.setting_service.register(self.module_name, "websocket_relay_enabled", False, BooleanSettingType(), "Enable the websocket relay") self.setting_service.register( self.module_name, "websocket_relay_server_address", "wss://ws.nadybot.org", TextSettingType( ["ws://localhost/subscribe/relay", "wss://ws.nadybot.org"]), "The address of the websocket relay server (must be the same on all bots)", "Point this to a running instance of https://github.com/Nadybot/highway" ) self.setting_service.register( self.module_name, "websocket_relay_room", "", TextSettingType(allow_empty=True), "The name of the websocket room to join (must be the same on all bots)" ) self.setting_service.register( self.module_name, "websocket_relay_channel_color", "#FFFF00", ColorSettingType(), "Color of the channel in websocket relay messages") self.setting_service.register( self.module_name, "websocket_relay_message_color", "#FCA712", ColorSettingType(), "Color of the message content in websocket relay messages") self.setting_service.register( self.module_name, "websocket_relay_sender_color", "#00DE42", ColorSettingType(), "Color of the sender in websocket relay messages") self.setting_service.register( self.module_name, "websocket_encryption_key", "", HiddenSettingType(allow_empty=True), "An encryption key used to encrypt messages over a public websocket relay" ) self.initialize_encrypter( self.setting_service.get("websocket_encryption_key").get_value()) self.setting_service.register_change_listener( "websocket_relay_enabled", self.websocket_relay_update) self.setting_service.register_change_listener( "websocket_relay_server_address", self.websocket_relay_update) self.setting_service.register_change_listener( "websocket_encryption_key", self.websocket_relay_update) self.setting_service.register_change_listener( "websocket_relay_room", self.websocket_relay_update) self.setting_service.register( self.module_name, "websocket_symbol", "#", TextSettingType(["!", "#", "*", "@", "$", "+", "-"]), "Symbol for websocket relay") self.setting_service.register( self.module_name, "websocket_symbol_method", "Always", TextSettingType(["Always", "with_symbol", "unless_symbol"]), "When to relay messages")
def news_color(self): return ColorSettingType()
def start(self): self.setting_service.register(self.module_name, "relaygcr_type", "private_channel", TextSettingType(["tell", "private_channel"]), "Type of relay") self.setting_service.register(self.module_name, "relaygcr_symbol", "@", TextSettingType(["!", "#", "*", "@", "$", "+", "-"]), "Symbol for external relay") self.setting_service.register(self.module_name, "relaygcr_symbol_method", "with_symbol", TextSettingType(["Always", "with_symbol", "unless_symbol"]), "When to relay messages") self.setting_service.register(self.module_name, "relaygcr_bot", "Relay", TextSettingType(), "Bot for Guildrelay") self.setting_service.register(self.module_name, "relaygcr_enabled", False, BooleanSettingType(), "Is the Module Enabled?") self.setting_service.register(self.module_name, "relaygcr_color_guild", "#C3C3C3", ColorSettingType(), "Color of messages from relay to guild channel") self.setting_service.register(self.module_name, "relaygcr_color_priv", "#C3C3C3", ColorSettingType(), "Color of messages from relay to priv channel") self.setting_service.register(self.module_name, "relaygcr_guest", False, BooleanSettingType(), "Relay the Private/Guest Channel") self.setting_service.register(self.module_name, "relaygcr_guild_abbreviation", "ORG_TAG", TextSettingType(), "Abbreviation to use for org name") self.setting_service.register(self.module_name, "relaygcr_share", False, BooleanSettingType(), "Do we share online lists with relayed partners?") self.setting_service.register(self.module_name, "relaygcr_others", "", TextSettingType(allow_empty=True), "Online wanted Bot(s) unspaced list ; separated (example: Bot1;Bot2;Bot3)") self.bot.register_packet_handler(server_packets.PrivateChannelInvited.id, self.handle_private_channel_invite) self.bot.register_packet_handler(server_packets.PrivateChannelMessage.id, self.handle_private_channel_message) self.bot.register_packet_handler(server_packets.PublicChannelMessage.id, self.handle_org_channel_message)
def unread_color(self): return ColorSettingType()
def relay_color_prefix(self): return ColorSettingType()
def relay_color_name(self): return ColorSettingType()
def leader_echo_color(self): return ColorSettingType()
def start(self): super().start() self.setting_service.register( self.module_name, "co_leader_echo_color", "#FFD700", ColorSettingType(), "Color with which the co-leader's messages will be echoed with")