Giter Club home page Giter Club logo

go-discord-irc's Introduction

go-discord-irc

Go Report Card GoDoc

Preview

This is an IRC to Discord bridge built just for @compsoc-edinburgh and ImaginaryNet.

  • The IRC -> Discord side of things work as you would expect it to: messages on IRC send to Discord as the bot user, as per usual.
  • The Discord -> IRC side of things is a little different. On connect, this bot will join the server with the ~d, and spawn additional connections for each online person in the Discord.
  • Supports bidirectional PMs

Gotchas

Things to keep in mind in terms of functionality:

  • This does not work with private IRC/Discord channels (yet)
  • DO NOT USE THE SAME DISCORD BOT (API KEY) ACROSS MULTIPLE GUILDS (SERVERS). SUPPORT FOR THIS WILL COME SOON. YOU RISK PMs BEING LEAKED

It's built with configuration in mind, but may need a little bit of tweaking for it to work for you:

  • Hardcoded: Hostnames are hardcoded to follow the IPv6 IPs listed here.
  • Server mod: Discord usernames will have ~d tacked on at the end. This usually invalid nickname character required custom modifications to the IRC server code. This is configurable.
  • Server config: This uses WEBIRC to give Discord users on IRC a distinct hostname. See here.

Configuration

The binary takes three flags:

  • --config filename.yaml: to pass along a configuration file containing things like passwords and channel options
  • --simple: to only spawn one connection (the listener will send across messages from Discord) instead of a connection per online Discord user
  • --debug: provide this flag to print extra debug info. Setting this flag to false (or not providing this flag) will take the value from the config file instead
  • --insecure: used to skip TLS verification (false = use value from settings)

The config file is a yaml formatted file with the following fields:

  • discord_token, the bot user token
  • channel_mappings, a dict with irc channel as key (prefixed with #) and Discord channel ID as value
  • suffix, appended to each Discord user's nickname when they are connected to IRC
  • irc_listener_name, the name of the irc listener
  • guild_id, the Discord guild (server) id
  • webirc_pass, optional, but recommended for regular (non-simple) usage. this must be obtained by the IRC sysops
  • debug, debug mode
  • insecure, insecure mode
  • webhook_prefix, a prefix for webhooks, so we know which ones to keep and which ones to delete
  • webhook_limit, integer limit for the maximum number of webhooks to create
  • nickserv_identify, optional, on connect this message will be sent: PRIVMSG nickserv IDENTIFY <value>, you can provide both a username and password if your ircd supports it

The filename.yaml file is continuously read from and many changes will automatically update on the bridge. This means you can add or remove channels without restarting the bot.

An example configuration file (those marked as requires restart definitely require restart, but others may not currently be configured to automatically update):

discord_token: abc.def.ghi
irc_server: localhost:6697
guild_id: 315277951597936640
nickserv_identify: password123
channel_mappings:
  "#bottest chanKey": 316038111811600387
  "#bottest2": 318327329044561920
suffix: "_d2"
irc_listener_name: "_d2"
webirc_pass: abcdef.ghijk.lmnop
insecure: true # this requires restart
debug: false
webhook_prefix: "(auto-test)" # this probably requires restart
webhook_limit: 3
#simple: true # this requires restart

This bot needs permissions to manage webhooks as it creates webhooks on the go.

https://discordapp.com/oauth2/authorize?&client_id=<YOUR_CLIENT_ID_HERE>&scope=bot&permissions=0x20000000

go-discord-irc's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.