Skip to content

Instantly share code, notes, and snippets.

@usrbinsam
Last active May 5, 2022 23:19
Show Gist options
  • Save usrbinsam/f856953c70f0a0032e2ce5ff416d30dc to your computer and use it in GitHub Desktop.
Save usrbinsam/f856953c70f0a0032e2ce5ff416d30dc to your computer and use it in GitHub Desktop.
weechat trigger to re-print relay bot as IRC users

WeeChat users can use the following to re-print relayed Discord messages to appear as a regular IRC user.

Special thanks to @aaronmdjones for the regex expertise.

Example

Instead of

  +relaybot | <discord-user> hi!
  +relaybot | <discord-user> I'm on discord

You get

  *discord-user | hi!
  *discord-user | i'm on discord

Trigger

/trigger add DiscordRelay#oi modifier "weechat_print" "${tg_buffer} == irc.AlphaChat.#oi && ${tg_tag_nick} == bridges" "/[^<]+<([^>]+)> (.*)/${color:red}*${color:reset}${re:1}\t${re:2}/" "" "" "none"

The conditions of the trigger can be re-used to suit other Discord <-> IRC relays as well. To do so, simply update the ${tg_buffer} and ${tg_tag_nick} operands accordingly. If you desire a more explicit match to the relay bot, use ${tg_tag_host} == ~user@host.tld.

Note that this is not compatible with the setting weechat.look.prefix_same_nick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment