Thread: Add a Discord Bot to your server!

Results 1 to 6 of 6
  1. #1 Add a Discord Bot to your server! 
    *breaks walking*

    Cody_'s Avatar
    Join Date
    Dec 2010
    Posts
    732
    Thanks given
    219
    Thanks received
    203
    Rep Power
    286
    Note: this guide is outdated. PM me for updated guide.

    First off, this is very basic, and is intended to be. It's just for people that weren't sure how this was done, or for people looking for very basic functionality

    I have written a VERY basic library that utilises the Discord4J library to make a Discord Bot.

    https://discordapp.com/developers/applications/me

    Follow this link and create a new Application giving it your desired name and profile picture.

    Once you are finished, you will be at this screen:



    Click on 'Create a Bot User', and you will now get this:



    Click to reveal the token and save this somewhere. DO NOT GIVE THIS OUT OTHERWISE PEOPLE WILL BE ABLE TO LOGIN TO YOUR BOT.
    Also save the client ID that is up top.

    Your discord bot has now been created.

    Now you need to add it to your discord channel.

    Following this link will add your bot to a guild, replacing client_id with the client id we got earlier, and using this page to find out the permission flag: https://discordapp.com/developers/do...cs/permissions
    Note: If you are unsure about the permission flag, using 0x00000008 will give your bot administrative permissions. Beware as this is giving your bot full access.
    Also Note: Doing this requires you to have 'Manage Server' permissions on whatever channel you are trying to add it to.

    https://discordapp.com/api/oauth2/au...RMISSIONS_FLAG

    Now you can use this library to add it to your RSPS:



    Make sure you add the Discord4J library to your classpath as well! Instructions can be found here: https://github.com/austinv11/Discord4J

    At the moment this is very basic and will only allow you to add different commands. This cannot currently link in-game accounts with discord accounts, or anything like that, didn't feel like adding that into something this basic.
    If enough people want it though I can add more functionality.

    Usage: (where CLIENT_TOKEN = the token we got earlier)
    Code:
    DiscordBot bot = new DiscordBot(DiscordSettings.build("CLIENT_TOKEN"));
    		bot.run();
    		bot.registerCommandListener(new DefaultCommandListener(bot, "."));
    This is what DefaultCommandListener looks like:

    Code:
    package com.cryo;
    
    import com.cryo.listener.CommandListener;
    
    import sx.blah.discord.handle.obj.IMessage;
    
    public class DefaultCommandListener extends CommandListener {
    
    	public DefaultCommandListener(DiscordBot bot, String commandPrefix) {
    		super(bot, commandPrefix);
    	}
    
    	@Override
    	public void handleCommand(IMessage message, String command, String[] cmd) {
    		cmd[0] = cmd[0].toLowerCase();
    		String channelId = message.getChannel().getID();
    		switch(cmd[0]) {
    		case "test":
    			String author_id = message.getAuthor().getID();
    			bot.deleteMessage(message);
    			bot.sendMessage(channelId, "UserID: "+author_id);
    			break;
    		}
    	}
    
    }
    I wrote this in about 20 minutes, but I don't really see there being any errors, it's pretty basic.
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    van 't stad

    Shnek's Avatar
    Join Date
    Oct 2013
    Posts
    1,065
    Thanks given
    343
    Thanks received
    297
    Rep Power
    109
    goodjob ! will def help some people
    Attached image

    Do not use the vps from ovh, blocking vps without reason and no customer support
    Reply With Quote  
     

  4. #3  
    Registered Member
    Join Date
    Oct 2016
    Posts
    11
    Thanks given
    9
    Thanks received
    0
    Rep Power
    6
    Thanks will help me a lot bro
    Reply With Quote  
     

  5. #4  
    Registered Member
    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    26
    Posts
    5,103
    Thanks given
    1,818
    Thanks received
    1,767
    Rep Power
    2438
    Nice, pretty useful.
    Quote Originally Posted by blakeman8192 View Post
    Keep trying. Quitting is the only true failure.
    Spoiler for skrrrrr:

    Attached image
    Reply With Quote  
     

  6. #5  
    Husband. Father.
    Loyalty_'s Avatar
    Join Date
    Aug 2013
    Age
    28
    Posts
    1,170
    Thanks given
    74
    Thanks received
    130
    Rep Power
    64
    Nice job, haha
    Loyalty_





    Quote Originally Posted by Falconpunch View Post
    Player.java buddy. find init() or something like that and find where it adds the starter and do what someone mentioned above (Although an int is 4 scrublords)
    Reply With Quote  
     

  7. #6  
    WVWVWVWVWVWVWVW

    _jordan's Avatar
    Join Date
    Nov 2012
    Posts
    3,046
    Thanks given
    111
    Thanks received
    1,848
    Rep Power
    5000
    nice release Cody
    Attached image
    Attached image
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Heres some cool commands to add to your server
    By xx k03d xx in forum Tutorials
    Replies: 13
    Last Post: 06-04-2008, 10:52 PM
  2. Add guide to your server (100% rs accurate)
    By marioman in forum Tutorials
    Replies: 29
    Last Post: 06-04-2008, 03:49 PM
  3. Replies: 48
    Last Post: 03-22-2008, 03:44 PM
  4. Replies: 23
    Last Post: 10-20-2007, 05:00 PM
  5. how to add objects to your server
    By mr_moo21 in forum Tutorials
    Replies: 16
    Last Post: 10-03-2007, 11:32 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •