Welcome to Funday Urdu Forum

Guest Image

Welcome to Funday Urdu Forum, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of Funday Urdu Forum by signing in or creating an account via default Sign up page or social links such as: Facebook, Twitter or Google.

  • Start new topics and reply to others
  • Subscribe to topics and forums to get email updates
  • Get your own profile page and make new friends
  • Send personal messages to other members.
  • Upload or Download IPS Community files such as:  Applications, Plugins etc.
  • Upload or Download your Favorite Books, Novels in PDF format. 

Sign in to follow this  
Followers 0
ADMIN

IPS4-Tutorial
IPB to Discord (Bot)

Rate this topic

1 post in this topic

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Forum Statistics

    1,712
    Total Topics
    7,635
    Total Posts