While waiting till I can continue with my dragon-on-the-CE-project I decided to try to make a Discordbot!
It's still kinda basic, but it can already say stuff and react on things!
And I've today also found out a way to link it to #flood on IRC!
I've a Discord channel where the bot is in, and the general textchannel is linked to IRC via another bot that I made therefore.

I am hosting the bot myself BTW!

I've also uploaded the source code to Github, but I've set it on private, so if you want to view it, just send me a message with your Github username, and I'll give you access!

Any ideas of stuff that I should really add are welcome.
I decided to try to also make a bot that connects with a specific user on IRC.

Step 1: go to the [url=discord.com/developers/]Discord developer portal[/url] and log in.
Step 2: Click on "New application", give it a name and click 'create'.
Step 3: Go there to 'bot' and click on "New bot" (or something like that).
Step 4: Give the bot a username and configure the settings.
Step 5: Create a folder on your PC to put your bot in.
Step 7: Open the command line and type: "cd [Location of the bot-folder]"
Step 8: Create in the bot-folder a new text file which you name: [somename].js
Step 9: Copy the code displayed below into the text file.
Step 10: Fill in for the parts in caps, the details you want. for the DISCORD-BOT-TOKEN, you need to go to your bot on the Discord Developer portal, and click by the bot at "reveal token", put that token instead of the DISCORD-BOT-TOKEN. NOTE: NEVER SHARE THE TOKEN WITH OTHER PEOPLE!!!
step 11:get the bot in your server by following the link: https://discordapp.com/oauth2/authorize?client_id=CLIENTID&scope=bot where you remove CLIENTID for the client id that you can find at the general information of your 'application'.
Step 12: in the command line type: "node install discord.js"
Step 13: In the command line type: "node install irc"
Step 14: In the command line type: "node BOTFILENAME.js" where BOTFILENAME is the name of your bot file.


Code:
const Discord = require('discord.js');
 const client = new Discord.Client();
 var irc = require("irc");
 var config = {
   channels: ["CHANNEL"],    //the channels
   server: "SERVER", //the IRC server
   botName: "SOMETHING",    //the name of the bot   
    ident: "SOMETHING"       //the ident of the bot     
};
var botlink = new irc.Client(config.server, config.botName, {   //setting up the bot
   channels: config.channels,
   userName: "SOMETHING",
    realName: "SOMETHING"
});
client.on('ready', () => {
 console.log(`Logged in as ${client.user.tag}!`);
 });
botlink.on("message", function(from, to, text, msg){
    //if there is an message on the IRC channel, send it to the Discord channel.
    client.channels.cache.get('DISCORD-CHANNEL-ID').send(`${text}`);
});
client.on('message', msg => {
    //if there is a message on the Discord and it is NOT from the bot itself, send it to a specific reciepent
    var b = msg.author.id;
    if (b!='DISCORD-BOT-ID'){botlink.say('RECIEPENT', `${msg.content}`);}
});
client.login('DISCORD-BOT-TOKEN');
It would be much nicer if you could provide an invite link so that people could invite your bot into their own server directly. Here's xkcdbot's invite link, as an example: https://discord.com/oauth2/authorize?client_id=694253560908742736&scope=bot&permissions=8192. It consists of some link stuff, a client ID, and a permissions bitfield- I used this application to generate it.
I have now a link to add Dragonbot to your own server!
Though there are some limitations; I don't want Dragonbot to be in too much servers at the moment, because I don't know yet how much data usage there will be with more servers.
So I'll start with one or two servers.

So if you want Dragonbot to be in your server, send me a DM, and probably you'll be the lucky one to add it to your server! There is no guarantee that I will allow it to be in your server, because, like I said, I want to begin with at most one or two servers. And if it comes into your server, one thing needed is that I will also be allowed to be in that server, so I can see it if the bot does stuff it shouldn't.
And if you don't get chosen to be the lucky one to get Dragonbot in your server, I'll write it down somewhere, in case there comes a new spot available!
Anyone can now add Dragonbot to their own server!
The link is: (I can remove dragonbot of servers if the data usage gets too much, but will only do that when really needed)
https://discordapp.com/oauth2/authorize?client_id=787397062449692725&scope=bot&permissions=2218253888
I still keep adding reactions to Dragonbot, so it keeps getting better over time!
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement