Coder Social home page Coder Social logo

botpress-discord's Introduction

botpress-discord

Installation

Installing modules on Botpress is simple. By using the CLI, you only need to type this command in your terminal to add the discord module to your bot.

botpress install discord

It's also possible to install it though the Botpress UI in the modules section. (probably)

Get started

1. Create a new Discord app

Create app

2. Add a bot user to your app

Just press the "Add bot user button"

3. Copy the newly generated token

4. Insert the token into the config

The config is located at modules_config/botpress-discord.json. Insert the token as string at the key "botToken".

5. ????

6. Profit!

Features

Incoming

Outgoing

Reference

Incoming

You can listen to incoming events easily with Botpress by using the built-in "hear" function.

Ready
bp.hear({platform: "discord", type: "ready"}, (event) => {
	let client = event.discord;
})
Messages
bp.hear({platform: "discord", type: "message", text: /^hello/i}, event => {
	bp.discord.sendText(event.channel.id, "Welcome!")
})
User status update
bp.hear({platform: "discord", type: "status"}, (event) => {
	let user = event.user,
		status = event.status,
		game = event.game;
});
User typing
bp.hear({platform: "discord", type: "typing"}, (event) => {
	let user = event.user,
		channelID = event.channelID;
});

Text messages

An event is sent to middlewares for each incoming text message from Discord.

{
  platform: "discord",
  type: "text",
  user: e.author,
  text: e.content,
  channel: e.channel,
  raw: e
}

Outgoing

Text messages

bp.discord.sendText(channelId, text)
You can also pass extra params to this method (check out Eris documentation):
bp.discord.sendText( event.channel.id, "Welcome!", { 'embed': {
	title: "I'm an embed!",
	description: "Here is some more info, with **awesome** formatting.\nPretty *neat*, huh?",
}});

Attachments

bp.discord.sendAttachment(channelId, description, uri)

Images

bp.discord.sendImage(channelId, uri)

botpress-discord's People

Contributors

kidkrule avatar magnificentpako avatar slvnperron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

botpress-discord's Issues

Botpress X support

Are you planning to update to support Botpress X? Any estimated timeframe?

react is not defined

The connector breaks dashboard functionality.

botpress-discord.js:109:2

/***/ function(module, exports) {

	module.exports = react;

/***/ },

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.