Exiled-Team / DiscordIntegration

GNU General Public License v3.0
13 stars 36 forks source link

[BUG] Can't send commands to server from discord command channel #122

Closed ImDati closed 1 year ago

ImDati commented 1 year ago

Describe the bug I can't send commands such as cassie_sl or cassie for example through the command channel, even when the setup is correctly (I hope). The bot is saying "Command sent.", but nothing happens in the scp:sl server. The logs works fine, the playercount works fine.

To Reproduce No idea, I just installed a new scp:sl server with exiled, everything works fine, except this. DiscordIntegration and Exiled is on the newest non-beta version ([6.0.3-1.4.2] and [5.2.2]). SCP:SL Server and discord bot are started.

Expected behavior Obv the command should work, so if I use "send 1 cassie_sl e" it should say "e" as cassie_sl in the game. Same for all other commands.

Server logs Bot console log

16:10:31 HandleInter Dati used an interaction.
18:10:31 Send        Sending cassie_sl br
18:10:31 [2]         Sending aborted, not connected.
18:10:32 [1]         Received data {"$type":"DiscordIntegration.Dependency.RemoteCommand, DiscordIntegration.Dependency","action":2,"parameters":["1/36"]}

Server log

[2022-08-06 18:05:52.166] Nickname of 76561198106273857@steam is now Dati.
[2022-08-06 18:05:52.178] Player Dati (76561198106273857@steam) (4) connected with the IP: (HIDDEN)
[2022-08-06 18:18:22.286] New round has been started.

EXILED Version ("latest" is not a version): 5.2.2

Results of show plugins command in console: Total number of plugins: 11 Enabled plugins: 7 Disabled plugins: 4

                      Exiled.Events:
                            - Author: Exiled Team
                            - Version: 5.2.2.0
                            - Required Exiled Version: 5.2.2.0
                            - Prefix: exiled_events
                            - Priority: Highest
                      Common Utilities:
                            - Author: Joker119
                            - Version: 6.2.0.0
                            - Required Exiled Version: 5.2.1
                            - Prefix: CommonUtilities
                            - Priority: Medium
                      Exiled.CreditTags:
                            - Disabled
                            - Author: Babyboucher20 & iRebbok & Exiled Team
                            - Version: 5.2.2.0
                            - Required Exiled Version: 5.2.2.0
                            - Prefix: exiled_credits
                            - Priority: Medium
                      NukeLock:
                            - Author: Marco15453
                            - Version: 1.10.0
                            - Required Exiled Version: 5.1.3
                            - Prefix: nuke_lock
                            - Priority: Medium
                      Exiled.CustomRoles:
                            - Disabled
                            - Author: Exiled Team
                            - Version: 5.2.2.0
                            - Required Exiled Version: 5.2.2.0
                            - Prefix: exiled_custom_roles
                            - Priority: Medium
                      RespawnTimer:
                            - Author: Michal78900
                            - Version: 3.1.0
                            - Required Exiled Version: 5.0.0
                            - Prefix: respawn_timer
                            - Priority: Medium
                      Admin Tools:
                            - Author: Originally by Galaxy119. Modifications by KoukoCocoa & Thomasjosif
                            - Version: 5.0.0.0
                            - Required Exiled Version: 5.0.0
                            - Prefix: AT
                            - Priority: Medium
                      Exiled.Updater:
                            - Disabled
                            - Author: Exiled.Updater
                            - Version: 3.1.1.0
                            - Required Exiled Version: 5.2.2.0
                            - Prefix: exiled_updater
                            - Priority: Medium
                      Exiled.CustomItems:
                            - Disabled
                            - Author: Exiled Team
                            - Version: 5.2.2.0
                            - Required Exiled Version: 5.2.2.0
                            - Prefix: exiled_custom_items
                            - Priority: Medium
                      Exiled.Permissions:
                            - Author: Exiled Team
                            - Version: 5.2.2.0
                            - Required Exiled Version: 5.2.2.0
                            - Prefix: exiled_permissions
                            - Priority: Medium
                      DiscordIntegration:
                            - Author: DiscordIntegration
                            - Version: 6.0.3.0
                            - Required Exiled Version: 5.2.0
                            - Prefix: discord_integration
                            - Priority: Medium

Additional context Config:

"ValidCommands": {
    "1": {
      "ID REMOVED": [
        "cassie",
        "grenade",
        "explode",
        "rocket",
        "kill"
      ],
      "ID REMOVED": [
        "di",
        "di stafflist",
        "di playerlist",
        "discordintegration",
        "pm reload",
        "bc",
        "cassie_sl",
        "overcharge",
        "oban",
        "unban",
        "unban id",
        "unban ip",
        "@"
      ]
    }
  }
ImDati commented 1 year ago

image image

Maybe it has something to do with another issue, that one of the 2 bots only works for the interaction/slash commands, no idea why. So Bot #2 tried to send a command to Server #1, probably this is why it is not connected, but why is it only working for Bot 2, when both bots are setup in the config. Bot 1 is sending logs etc., but only Bot 2 can send commands.

Config (changed token, ip, port, id's):

{
  "BotTokens": {
    "1": "HIDDEN",
    "2": "HIDDEN"
  },
  "Channels": {
    "1": {
      "Logs": {
        "Commands": [
          123
        ],
        "GameEvents": [
          123
        ],
        "Bans": [
          123
        ],
        "Reports": [
          123
        ],
        "StaffCopy": [],
        "Errors": [
          123
        ]
      },
      "TopicInfo": [
        123,
        123
      ],
      "CommandChannel": [
        123
      ]
    }
  },
  "ValidCommands": {
    "1": {
      "123": [
        "cassie",
        "grenade",
        "explode",
        "rocket",
        "kill"
      ],
      "123": [
        "di",
        "di stafflist",
        "di playerlist",
        "discordintegration",
        "pm reload",
        "bc",
        "cassie_sl",
        "overcharge",
        "oban",
        "unban",
        "unban id",
        "unban ip",
        "@"
      ]
    }
  },
  "DiscordServerIds": {
    "1": 123,
    "2": 123
  },
  "TcpServers": {
    "1": {
      "Port": 123,
      "IpAddress": "123.123.123.123"
    },
    "2": {
      "Port": 124,
      "IpAddress": "123.123.123.123"
    }
  },
  "KeepAliveInterval": 2000,
  "MessageDelay": 3500,
  "Debug": true
}

EDIT: And yes I know that the config is missing commands and channels for server 2.

joker-119 commented 1 year ago

Both bots should have registered their own /send command on the discord. You need to use the correct bot's command. If there aren't multiple commands registered from both bots, one of them is probably missing the application.commands scope.

ImDati commented 1 year ago

Well, the permissions and everything was correct, I checked today multiple times and right now too, but I fixed it by reinvite the bot (and no I gave no permissions with the invite like before too), just the role that gave both bots the same perms. It also loaded the slash commands before already, but you couldn't use them in chat, such weird. Anyways it is fixed, thanks.