Giter Site home page Giter Site logo

slack-discord-bridge's Introduction

slack-discord-bridge

Bridges a text channel between Slack and Discord

Setup

  1. Prerequisites

You need to have Node.js installed. This includes the runtime and the package manager required to install the dependencies.

  1. Clone the repository
git clone [email protected]:HackSoc/slack-discord-bridge.git
  1. Install dependencies
cd slack-discord-bridge
npm install
  1. Set up API keys

Make copies of discord.keys.js.example and slack.keys.js.example and remove the .example ending.

For Discord, you need to create an app, then click "create bot user". Copy the bot user token into the bot_token field of discord.keys.js.
Next you need to create a webhook for the Discord channel of your choice. Click "Edit channel" (gear icon next to a text channel) and go to the webhooks section of the menu. (Note you will need the "Manage Webhooks" permission on your Discord server). Copy the ID and token (explained in discord.keys.js) into the relevant fields.

For Slack, it's a little more complicated. Create a new app and choose your workspace from the list.
First go to OAuth & Permissions, and if you haven't already, add the bot to your workspace. Scroll to Scopes and add users.profile:read.
Save changes, then go to Bot Users and add a bot user.
Finally go back to OAuth & Permissions and install the app to your workspace.
Copy the OAuth and Bot tokens to the correct places in slack.keys.js.

Now you need to add an Incoming Webhook as a custom integration. Note that if you add this as part of the Slack app you created, the messages on Slack won't have the username or avatar of the Discord users sending them. Choose the channel you want the webhook to post in, and copy the URL to hook_url in slack.keys.js.

  1. Running

node bot.js will run the bot until you stop it with Ctrl-C, but you may wish to leave it running longer than you have a terminal window open. An application running in the background is called a daemon. One way of daemonising this bot is to use pm2. After you have installed it, just run pm2 start bot.js in the same directory as bot.js.

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.