From 3adb91f7f098e90048c253464294948c8c22d30e Mon Sep 17 00:00:00 2001 From: aronson Date: Sat, 14 Oct 2023 21:30:21 -0500 Subject: [PATCH] Update README with better config examples (#48) --- README.md | 155 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 79 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index 8748158..050a237 100644 --- a/README.md +++ b/README.md @@ -129,83 +129,86 @@ First you need to create a Discord bot user, which you can do by following the i ### Example configuration ```jsonc -[ - // Bot 1 (minimal configuration): - { - "nickname": "test2", - "server": "irc.testbot.org", - "discordToken": "botwantsin123", - "channelMapping": { - "#other-discord": "#new-irc-channel" - } - }, - - // Bot 2 (advanced options): - { - "nickname": "test", - "server": "irc.bottest.org", - "port": 6697, - "tls": true, - "discordToken": "botwantsin123", - "autoSendCommands": [ - // Commands that will be sent on connect - ["PRIVMSG", "NickServ", "IDENTIFY password"], - ["MODE", "test", "+x"], - ["AUTH", "test", "password"] - ], - "channelMapping": { - // Maps each Discord-channel to an IRC-channel, used to direct messages to the correct place - "#discord": "#irc channel-password", // Add channel keys after the channel name - "1234567890": "#channel" // Use a discord channel ID instead of its name (so you can rename it or to disambiguate) - }, - "ircOptions": { - // Deno/irc options, see https://github.com/jeromeludmann/deno-irc/blob/main/API.md#options - "username": "test", - "password": "p455w0rd" - }, - "format": { - // Optional custom formatting options - // Patterns, represented by {$patternName}, are replaced when sending messages - "commandPrelude": "Command sent by {$nickname}", // Message sent before a command - "ircText": "<{$displayUsername} [@{$discordUsername}]> {$text}", // When sending a message to IRC - "urlAttachment": "<{$displayUsername}> {$attachmentURL}", // When sending a Discord attachment to IRC - "discord": "**<{$author}>** {$withMentions}", // When sending a message to Discord - // Other patterns that can be used: - // {$discordChannel} (e.g. #general) - // {$ircChannel} (e.g. #irc) - "webhookAvatarURL": "https://robohash.org/{$nickname}" // Default avatar to use for webhook messages - }, - "ircNickColor": false, // Gives usernames a color in IRC for better readability (on by default) - "ircNickColors": [ - "light_blue", - "dark_blue", - "light_red", - "dark_red", - "light_green", - "dark_green", - "magenta", - "light_magenta", - "orange", - "yellow", - "cyan", - "light_cyan" - ], // Which irc-upd colors to use - "parallelPingFix": true, // Prevents users of both IRC and Discord from being mentioned in IRC when they speak in Discord (off by default) - // Makes the bot hide the username prefix for messages that start - // with one of these characters (commands): - "commandCharacters": ["!", "."], - "ircStatusNotices": true, // Enables notifications in Discord when people join/part in the relevant IRC channel - "ignoreUsers": { - "irc": ["irc_nick1", "irc_nick2"], // Ignore specified IRC nicks and do not send their messages to Discord. - "discord": ["discord_nick1", "discord_nick2"], // Ignore specified Discord nicks and do not send their messages to IRC. - "discordIds": ["198528216523210752"] // Ignore specified Discord ids and do not send their messages to IRC. - }, - // List of webhooks per channel - "webhooks": { - "#discord": "https://discord.com/api/webhooks/id/token" - } +// Bot 1 (minimal configuration): +{ + "nickname": "test", + "server": "irc.testbot.org", + "discordToken": "botwantsin123", + "channelMapping": { + "#other-discord": "#new-irc-channel" } -] +} +``` + +```jsonc +// Bot 2 (advanced options, note some are conflicting): +{ + "nickname": "test", + "server": "irc.bottest.org", + "port": 6697, + "tls": true, + "discordToken": "botwantsin123", + "channelMapping": { + // Maps each Discord-channel to an IRC-channel, used to direct messages to the correct place + "#discord": "#irc channel-password", // Add channel keys after the channel name + "1234567890": "#channel" // Use a discord channel ID instead of its name (so you can rename it or to disambiguate) + }, + "ircOptions": { + // Deno/irc options, see https://github.com/jeromeludmann/deno-irc/blob/main/API.md#options + "username": "test", + "password": "p455w0rd", + "floodDelay": 2000 // milliseconds to wait between messages to avoid flood, 1000-2000 is generally safe + }, + "format": { + // Optional custom formatting options + // Patterns, represented by {$patternName}, are replaced when sending messages + "commandPrelude": "Command sent by {$nickname}", // Message sent before a command + "ircText": "<{$displayUsername} [@{$discordUsername}]> {$text}", // When sending a message to IRC + "urlAttachment": "<{$displayUsername}> {$attachmentURL}", // When sending a Discord attachment to IRC + "discord": "**<{$author}>** {$withMentions}", // When sending a message to Discord + // Other patterns that can be used: + // {$discordChannel} (e.g. #general) + // {$ircChannel} (e.g. #irc) + "webhookAvatarURL": "https://robohash.org/{$nickname}" // Default avatar to use for webhook messages + }, + "ircNickColor": true, // Gives usernames a color in IRC for better readability (on by default) + // Not including this property will use all the default colors + "ircNickColors": [ + "light_blue", + "dark_blue", + "light_red", + "dark_red", + "light_green", + "dark_green", + "magenta", + "light_magenta", + "orange", + "yellow", + "cyan", + "light_cyan" + ], // Which deno-irc colors to use + // Makes the bot hide the username prefix for messages that start + // with one of these characters (commands): + "commandCharacters": ["!", "."], + "ircStatusNotices": true, // Enables notifications in Discord when people join/part in the relevant IRC channel + "ignoreUsers": { + "irc": ["irc_nick1", "irc_nick2"], // Ignore specified IRC nicks and do not send their messages to Discord. + "discord": ["discord_nick1", "discord_nick2"], // Ignore specified Discord nicks and do not send their messages to IRC. + "discordIds": ["198528216523210752"] // Ignore specified Discord ids and do not send their messages to IRC. + }, + // List of webhooks per channel + "webhooks": { + "#discord": "https://discord.com/api/webhooks/id/token" + }, + // Commands that will be sent on connect + // Note: these are typically optional and only provided as a reference + "autoSendCommands": [ + // NickServ is better handled by ircOptions.password + ["PRIVMSG", "NickServ", "IDENTIFY password"], + ["MODE", "test", "+x"], + ["AUTH", "test", "password"] + ] +} ``` The `ircOptions` object is passed directly to deno/irc