reactiflux / discord-irc

Connects Discord and IRC channels by sending messages back and forth.
MIT License
1.2k stars 293 forks source link

Problems with your example (config.json) #518

Closed mrc4tt closed 4 years ago

mrc4tt commented 4 years ago

Hi,

There is a bug with the example config.json you provide:

[{
    "nickname": "test",
    "server": "irc.bottest.org",
    "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": { // Optional node-irc options
        "floodProtection": false, // On by default
        "floodProtectionDelay": 1000, // 500 by default
        "port": "6697", // 6697 by default
        "secure": true, // enable SSL, false by default
        "sasl": true, // false by default
        "username": "test", // nodeirc by default
        "password": "p455w0rd" // empty by default
    },
    "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}> {$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)
    "ircPreventMention": 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.
    },
    // List of webhooks per channel
    "webhooks": {
        "#discord": "https://discordapp.com/api/webhooks/id/token"
    }
}]

The problem is this:

Error: Parse error on line 5:
...utoSendCommands": [ // Commands that wil
-----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', ']', got 'undefined'

^^ So how to fix this with AutotoSendCommands? =)

mrc4tt commented 4 years ago

@Throne3d - How will you fix? ;) - Good idea, you should update the examples at readme.md

mrc4tt commented 4 years ago

Nvm.

Fixed it with removed ALL // comments! =)

aab12345 commented 3 years ago

json can't have comments like this but you can have comments though but it's a different format.