matrix-org / matrix-appservice-discord

A bridge between Matrix and Discord.
Apache License 2.0
791 stars 148 forks source link

Invalid user localpart for this application service #863

Closed oblak-be closed 1 year ago

oblak-be commented 1 year ago

Hello, after finally joining a discord server/channel from matrix, I can successfully send a message from matrix -> discord. Unfortunately, when sending a message back, from discord to matrix, the message doesn't arrive and I get this error in the appservice's logs:

│ bridge-discord Oct-13 23:59:19.963 [bot-sdkAppservice] error: [ 'Encountered error registering user: ' ]                                                                                                                                                                     
│ bridge-discord Oct-13 23:59:19.964 [bot-sdkAppservice] error: [                                                                                                                                                                                                              
│ bridge-discord   {                                                                                                                                                                                                                                                           
│ bridge-discord     errcode: 'M_EXCLUSIVE',                                                                                                                                                                                                                                   
│ bridge-discord     error: 'Invalid user localpart for this application service.'                                                                                                                                                                                             
│ bridge-discord   }                                                                                                                                                                                                                                                           
│ bridge-discord ]                                                                                                                                                                                                                                                             
│ bridge-discord Oct-13 23:59:19.980 [DiscordBot] error: Failed to send message into room. MatrixError: M_EXCLUSIVE: Invalid user localpart for this application service. 

The localpart in my discord-registration.yaml file:

sender_localpart: _discord_bot

Hopefully someone can help me out :)

Miepee commented 1 year ago

What does the full registration file look like (without tokens)?

oblak-be commented 1 year ago

Hello Miepee, heres the content of the registration file:


id: discord-bridge
as_token: "****"
hs_token: "****"
namespaces:
  users:
    - exclusive: true
      regex: '^@_discord_.*'
  aliases:
    - exclusive: true
      regex: '^#_discord_.*'
url: "http://matrix-bridge-discord:9005"
sender_localpart: _discord_bot
rate_limited: false
protocols:
  - discord
Miepee commented 1 year ago

The regex seem out of date; can you pull in a newer version and regenerate it? Potentially related to #848 and #838

oblak-be commented 1 year ago

Indeed, updating the regex fixed this issue, thanks for the help!!