Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from artificialsolutions/develop
Browse files Browse the repository at this point in the history
v1.0.1
  • Loading branch information
JosueGalher authored Nov 4, 2020
2 parents 4eb717c + cd22c52 commit 96a5c81
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 56 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# v.1.0.1
## 28/10/2020
1. [](#improved)
* Updated dependencies.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,22 @@ npm install
### Create a Discord bot application
Follow the instructions here to create a Discord bot application: [Setting up a bot application](https://discordjs.guide/preparations/setting-up-a-bot-application.html)

!!!! Make sure you remember the <mark>token</mark>, you will need it when you start the connector.
Take note of <mark>client_id</mark> of the new app, and the <mark>token</mark> of its bot, and store them safely. These will needed when you start the connector.

Also, the bot's username, which is formatted 'YourBot#1234' can be used later on to send Direct Messages to this bot.

### Add the bot to your Discord server
Follow the instructions here to add the bot to your server: [Adding your bot to servers](https://discordjs.guide/preparations/adding-your-bot-to-servers.html#bot-invite-links)
Follow the instructions here to add the bot to your server: [Adding your bot to servers](https://discordjs.guide/preparations/adding-your-bot-to-servers.html#bot-invite-links).
This involves opening a Bot inviting link in your browser which is contructed using the 'client_id' of the app that was obtained the previous step:

https://discord.com/oauth2/authorize?client_id=12345&scope=bot

Add the bot to an existing Server and authorize it. Create a Server if needed, by clicking on the '+' shaped Add Server button from the left menu of the Discord Chat.

### Start the connector
Start the connector with the following environment variables:
* **DISCORD_TOKEN:** The <mark>token</mark> you copied when you created the Discord bot application.
* **DISCORD_CHANNEL:** The bot will respond to direct messages only. If you want your bot to respond to *any* message from *any* user in a particular channel, provide the name of that channel here.
* **DISCORD_CHANNEL:** The bot will respond to direct messages only. If you want your bot to respond to *any* message from *any* user in a particular channel, provide the name of that channel here. For example, 'general' is a common channel name that is usually created automatically on every new Discord server.
* **TENEO_ENGINE_URL:** The engine url.

To start the connector (replacing the environment variables with the appropriate values) use the following command:
Expand Down
70 changes: 20 additions & 50 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@artificialsolutions/tie-api-example-discord",
"version": "1.0.0",
"version": "1.0.1",
"description": "A basic example Discord chatbot using Teneo",
"main": "server.js",
"scripts": {
Expand All @@ -14,7 +14,7 @@
"author": "Lucas Willering",
"license": "Apache-2.0",
"dependencies": {
"@artificialsolutions/tie-api-client": "^1.3.1",
"@artificialsolutions/tie-api-client": "^1.3.7",
"discord.js": "^11.4.2"
}
}
7 changes: 6 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ const teneoApi = TIE.init(teneoEngineUrl);
const sessionHandler = SessionHandler();

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

client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});

// receive message form discord
Expand Down Expand Up @@ -103,3 +107,4 @@ function SessionHandler() {
}

client.login(discordToken);
client

0 comments on commit 96a5c81

Please sign in to comment.