matrix-org / matrix-appservice-discord

A bridge between Matrix and Discord.
Apache License 2.0
804 stars 152 forks source link

Bot acting as a normal user and not bridging messages between Matrix and Discord #882

Open DALHOUM-Ahmed opened 1 year ago

DALHOUM-Ahmed commented 1 year ago

I've set up matrix-appservice-discord to bridge messages between a Matrix room and a Discord channel. However, the bot is only acting as a normal user and not forwarding messages between the two platforms.

Here's what I've done so far:

  1. Set up Synapse homeserver and matrix-appservice-discord.
  2. Configured the config.yaml file with the correct Matrix room ID, Discord guild ID, and Discord channel ID.
  3. Ensured that the bot has the necessary permissions on both Matrix and Discord.

Despite following the setup instructions, I am experiencing the following issues:

  1. The bot can only interact as a normal user, not as a bridge bot.
  2. When sending messages, the logs show a warning about the Matrix room not being found (Room(s) not found.).
  3. The bot is listening successfully to the Discord channel, but the logs indicate that the Matrix room is not being found. To investigate further, I added console logs in the GetRoomIdsFromChannel function in the channelsyncroniser.ts file:

    public async GetRoomIdsFromChannel(
    channel: Discord.Channel
    ): Promise<string[]> {
    
    const rooms = await this.roomStore.getEntriesByRemoteRoomData({
      discord_channel: channel.id,
    });
    
    console.log("channel.id", channel.id);
    
    console.log("rooms", rooms);
    
    if (rooms.length === 0) {
    
      log.verbose(`Couldn't find room(s) for channel ${channel.id}.`);
    
      return Promise.reject("Room(s) not found.");
    
    }
    return rooms.map((room) => room.matrix!.getId() as string);
    
    }

Here's a sample of the logs when I start typing in my Discord room:

warning ../../../package.json: No license field

$ yarn build && node ./build/src/discordas.js -c config.yaml

warning ../../../package.json: No license field

$ tsc

channel.id 1100388067380056165

rooms []

Apr-29 18:09:49.294 [DiscordBot] warn: Exception thrown while handling "typingStart" event Room(s) not found.

I would appreciate any guidance on how to resolve this issue and get the bot to successfully bridge messages between Matrix and Discord.

iameli commented 1 year ago

Running into something very similar with the Room(s) not found message. Any luck?