Skip to content

swapnilsparsh/GIF-Discord-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GIF-Discord-Bot

A simple discord bot that helps you send gif in your server using command !gif command

Tech Stack

Steps to create new bot

  1. Create node project and install discord.js module.
$ npm init
$ npm install discord.js
  1. Create an application - optionally set name, description, avatar.

  2. Select Bot from left navigation and "Add Bot" - set name and icon.

  3. Add bot to the your server with the url: https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot

  4. Write the code!

Login to bot account:

const Discord = require('discord.js');
const client = new Discord.Client();
client.login('YOUR BOT TOKEN');

Callback for when the bot is connected and ready:

client.once('ready', () => {
  console.log('Ready!');
});

Callback for when a message is posted:

client.on('message', gotMessage);

function gotMessage(msg) {
  console.log(msg.content);
}
  1. Run the bot!
$ node index.js

Store token and other secrets in .env file.

  1. Install dotenv package.
$ npm install dotenv
  1. Create .env file (get reference from .env.example file):
BOT_TOKEN=123456789
CHANNEL_TOKEN=123456789
API_KEY=123456789

License

This project follows the MIT License.

Made with ♥ by Swapnil Srivastava

forthebadge

github linkedin

About

A simple discord bot that helps you send gif in your server using command !gif command

Topics

Resources

License

Stars

Watchers

Forks