Jump to content

IPB to Discord (Bot)

Rate this topic


Recommended Posts

Wasn't too sure if this is the right section, but this is where I felt it was most appropriate from the forum titles I could see. I in no way claim to own this as I just found it on a small forum and thought others may find it useful. I have edited the Read Me below to contain more up to date and relevant information.

Shiroyuki JavaScript IPB to Discord Bot.

Summary:

This is a JavaScript bot developed using Node.JS which connects to discord via the Eris library. This bot uses REST API to grab information like the latest threads, posts, and users from Invision Power Boards. This is only a basic bot and as such can only post latest threads, authors, and posts but I will be expanding it in future to include many other useful things.

Features

  1. Uses REST API to grab Latest Thread
  2. Uses REST API to grab Latest Post
  3. Uses REST API to grab username of aforementioned things, and posts it in discord.
  4. URL Shortener (using https://goo.gl/)
  5. Syncing usernames on Discord with IPB Usernames (currently done with JSON file and a command)

To be implemented:

  1. automatic syncing of names.

Installation

  1. Download LTS Version of NodeJS from NodeJS
  2. Download files from github and extract them to wherever you like.
  3. Setup your REST API.
  4. Open Node.JS in your favorite editor eg Notepad++, Sublime, Atom etc.
  5. Edit the following sections and replace them with your own information.

Setting up REST API

Go to your Admin Control Panel -> System -> Underneath Site Features click "REST API" -> Create New and make it according to the image below. In regards to "Posts" Do the same as Topics with 4 Endpoints for it to gather information from. I just couldn't crop it out nicely and added this text as a result.

d0c2ENf.png

 

Setting up the bot.

Replace:

googl.setKey('');

with your own API from Goo.gl in this section. Link can be found by clicking ---> Goo.gl API page <---

Replace:

var bot = new Eris(""); //This is your discord bot token

with your own token which can be gotten from ---> Discord Developers <---

Replace:

var username = '' //enter in your {REST API Key} here
var password = '' //Leave this blank

with your REST API key which you can make by going to IP Board Admin Control Panel -> System -> REST API and leave the password section blank. Otherwise this will not work as the API uses a basic authentication method.

forumDomain = "", //replace with your domain name

Replace the both of these with your different messages for Posts and Threads, Discord emotes will work as far as I am aware. For further documentation on the REST API I recommend you check IPB4 REST Api

Finally replace:

var postMessage = ":regional_indicator_n: :regional_indicator_e: :regional_indicator_w: :snowflake: :regional_indicator_p:  :regional_indicator_o: :regional_indicator_s: :regional_indicator_t:"; // What message will come before linking to to new post."
var threadMessage = ":regional_indicator_n: :regional_indicator_e::regional_indicator_w: :snowflake: :regional_indicator_t: :regional_indicator_h::regional_indicator_r::regional_indicator_e: :regional_indicator_a::regional_indicator_d:"; // What message will come before linking to to new thread.

with whatever you want the bot to say when a thread/post is posted on the forums. At the moment it'll post something like this.

Example Image

Some of the text was removed for security, and because I felt like removing it.

After you've edited the file to suit the needs of your Discord and IPB Forums go to CMD and navigate to the location of your bot. Eg: cd C:\Users\<Your Username>\Desktop\Discord-Bot and type "node bot.js" without the quotation marks.

To sync users

go to your discord channel and type !addNewTag FORUMUSERNAME @discordname (replace "!" with whatever you set your bot command prefix to) What this will do is whenever "FORUMUSERNAME" makes a thread and or post it'll automatically grab the forum username and if it matches with a preexisting discord name (via the use of the command (!addNewTag FORUMUSERNAME @discordname) it will change FORUMNAME into the discord name.

Issues

  1. At the current time: NONE

Shiroyuki_IPB_to_Discord.rar

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Forum Statistics

    2.3k
    Total Topics
    9.6k
    Total Posts
×
×
  • Create New...