Coder Social home page Coder Social logo

mirai's Introduction

Mirai Bot
David GitHub license Code Climate

An easy to use bot framework using the Eris library. NodeJS version 6+ is REQUIRED

Installing:

  1. Install NodeJS Git and Python2.7 (and add them to your PATH).
  2. Download Mirai Bot and configure it using the reference below.
  3. Run npm i --no-optional --production and then, optionally, npm i eventemitter3 bluebird --no-optional --production.
  4. Make any modifications.
  5. Add your bot using https://discordapp.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot.
  6. Run the bot with node Mirai.js

Example of a command

// Mirai\commands\examples\example.js
// Only 'task' is required. Everything else is optional.

module.exports = {
	desc: "A short description",
	help: "A longer description of what the command does and how to use it.",
	usage: "<hello> [world]",
	aliases: ['ex', 'e'], // Aliases 'ex' and 'e'
	cooldown: 5, // 5 seconds
	hidden: true, // Hidden from help command
	ownerOnly: true, // Only a user in config.adminIds can use this
	guildOnly: true, // This can't be used in a DM
	requiredPermission: 'manageMessages', // You need manageMessages to use this
	task(bot, msg, suffix, config, settingsManager) { // Available args
		if (suffix.startsWith('hello'))
			return bot.createMessage(msg.channel.id, suffix);
		return 'wrong usage'; // Send the correct usage to the user
	}
}

Example of an event

// Mirai\events\guildCreate.js

module.exports = function(bot, settingsManager, config, guild) {
	if (config.logNewGuilds)
		console.log(`New Guild: ${guild.name}`);
}

Config Reference

  • token: The Bot's token.
  • shardCount: The number of shards to run.
  • disableEvents: An object containing events to disable. This saves resources. A full list of events can be found here: Eris Reference.
  • commandSets: An object defining what commands to load. The key is the prefix, dir is the path to the from the root of the bot. If you want to make the commands a certain color in the console add a color property with a valid chalk color.
  • reloadCommand: The command to use for reloading modules/commands.
  • evalCommand: The command to use for running arbitrary code.
  • adminIds: An array of user ids that have full control over the bot.
  • logTimestamp: If the console should include timestamps.
  • cleverbot: If cleverbot should be enabled.
  • inviteLink: A link to add the bot to a server.
  • errorMessage: An optional error message to post in chat.
  • carbonKey: Your key for updating carbon information.
  • abalBotsKey: Your https://bots.discord.pw/ API key.
  • cycleGames: Randomly changes the bot's status.
  • bannedGuildIds: Servers that can not add the bot.
  • whitelistedGuildIds: For future use.

Naming commands and invalid prefixes

Command names must not contain a space or a |. Prefixes must not contain a |. Avoid using a @ as it may resolve into a user.


Disclaimer: There is no guarantee that this will continue to be maintained. I may decide one day to discontinue this.

mirai's People

Contributors

brussell98 avatar hsiw avatar nandub avatar

Watchers

 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.