matrix-org / matrix-appservice-irc

Node.js IRC bridge for Matrix
Apache License 2.0
462 stars 151 forks source link

Possibility to remove the #irc_ prefix #770

Open KlaasT opened 5 years ago

KlaasT commented 5 years ago

I wanted to ask if it is possible to remove the #irc_ prefix from the rooms using the bridge. In the alias template I tried to set it to "$CHANNEL" however the appservice is then complaining about some regex not working out.

Thanks.

Half-Shot commented 5 years ago

You should be able to modify it if you edit the registration file too? If that fails, what does it say exactly?

KlaasT commented 5 years ago

This is what I get when removing the #irc_ prefix.

Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: {"field":"data.ircService.servers[keys1.0].dynamicChannels.aliasTemplate","message":"pattern mismatch","value":"$CHANNEL","type":"string","schemaPath":["properties","ircService","properties","servers","additionalProperties","properties","dynamicChannels","properties","aliasTemplate"]} Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: The field data.ircService.servers[keys1.0].dynamicChannels.aliasTemplate is $CHANNEL which pattern mismatch Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: /usr/lib/node_modules/matrix-appservice-irc/node_modules/matrix-appservice-bridge/lib/components/config-validator.js:44 Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: throw e; Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: ^ Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: Error: Failed to validate file Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at ConfigValidator.validate (/usr/lib/node_modules/matrix-appservice-irc/node_modules/matrix-appservice-bridge/lib/components/config-validator.js:42:17) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at Cli._loadConfig (/usr/lib/node_modules/matrix-appservice-irc/node_modules/matrix-appservice-bridge/lib/components/cli.js:160:22) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at Cli._assignConfigFile (/usr/lib/node_modules/matrix-appservice-irc/node_modules/matrix-appservice-bridge/lib/components/cli.js:145:23) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at Cli.run (/usr/lib/node_modules/matrix-appservice-irc/node_modules/matrix-appservice-bridge/lib/components/cli.js:139:10) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at Object. (/usr/lib/node_modules/matrix-appservice-irc/app.js:50:4) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at Module._compile (internal/modules/cjs/loader.js:776:30) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at Module.load (internal/modules/cjs/loader.js:653:32) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at Function.Module._load (internal/modules/cjs/loader.js:585:3) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at Function.Module.runMain (internal/modules/cjs/loader.js:829:12) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at startup (internal/bootstrap/node.js:283:19) Jul 26 12:38:01 defks-p-ap02 matrix-appservice-irc[18674]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

The registration file:


  aliases:
    - exclusive: true
      regex: '#.*:servername\.de'

And in the config file of the bridge I try to just use $CHANNEL as the alias.

It is working when I add a # to the $CHANNEL alias in the config file. However then the channels are known as ##channelname in Matrix. I could imagine I'm only thinking the wrong way?