Coder Social home page Coder Social logo

discord-bot's Introduction

Discord-Bot

Features

The bot has a number of features for moderation, images and entertainment. The full list of commands is below.

commands

Self-Hosting Instructions

To host the bot yourself, you need to have Node.js and FFmpeg installed. If you plan to host on Heroku, this buildpack ensures your dyno has the latest version of FFmpeg installed.

Download the latest release to start.

API Keys and Settings

A settings file or environment variables are required to run the bot. The settings file is parsed as JSON and should look like this:

{
  "token": "Your-Discord-API-Token",
  "ytApiKey": "Your-YouTube-Data-API-Key",
  "prefix": ">",
  "messageLifeTime": 10000
}

If you are hosting the bot online and want to keep your API keys hidden, you can use environment variables to store this information. They are as follows:

BOT_API_TOKEN = "Your-Discord-API-Token"
YOUTUBE_API_KEY = "Your-YouTube-Data-API-Key"
BOT_PREFIX = ">"
BOT_MESSAGE_LIFETIME = 10000

You can get a discord API token from here.

You can get a YouTube data API key from here.

Your prefix is what users type before a command for the bot to respond to. eg. >test, >play.

Message life time is how long (milliseconds) before certain messages sent by the bot are deleted. The messages deleted are things like a user not supplying the correct arguments or other error messages.

Google Cloud Storage

Additionally this bot will store data in two files named inventories.json and questions.json. Using Google Cloud, it stores and fetches these files in case the bot should ever go down. If you are using a service to host the bot that cannot store data files persistently (like Heroku), then creating a Google cloud API key and setting up a simple storage bucket will allow you to keep that data through downtime.

You can create a Google cloud account here.

Once you have your credentials file, simply store it as an environment variable and it will be parsed a JSON object. The variable name should be GOOGLE_APPLICATION_CREDENTIALS.

Alternatively you can simply link to the .json file in the code. The code is commented out, all you have to do is uncomment and provide the path where specified.

If you don't need to store your data files elsewhere, you can disable Google Cloud integration in the googleCloud.js file. Set module.exports.ACTIVE to false and comment out the storage variable at the top of the file.

Ignored Servers

If you want the bot to ignore specific servers, copy their guild ID and add an environment variable called IGNORED_SERVER_IDS. It looks like this:

{
"Server-ID-To-Ignore": true,
"Server-ID-To-Ignore2": true
}

You can also edit the object directly in the code at the top of the bot.js file.

discord-bot's People

Contributors

michael23b avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.