2.1.0 • Published 7 years ago

botpress-discord v2.1.0

Weekly downloads
2
License
AGPL-3.0
Repository
github
Last release
7 years ago

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

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)
2.1.0

7 years ago

2.0.9

7 years ago

2.0.8

7 years ago

2.0.7

7 years ago

2.0.6

7 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago