Update 0.7.2: Fix @everyone replacement

This commit is contained in:
Charlie Laabs
2020-03-19 17:25:56 -05:00
parent 48f17cebb9
commit 22902e2538
3 changed files with 12 additions and 9 deletions

View File

@@ -17,12 +17,12 @@ First, create a [Discord bot application](https://discordapp.com/developers/appl
### Windows
#### Requirements
#### Windows Requirements
* [Node.js 12.0+ (Current)](https://nodejs.org/en/download/)
* Installing with build tools is recommended
#### Setup
#### Windows Setup
1. Install Node.js 12.0 or newer.
1. Download this repository using git in a command prompt
@@ -62,7 +62,7 @@ First, create a [Discord bot application](https://discordapp.com/developers/appl
### Debian Linux
#### Requirements
#### Debian Requirements
* Node.js 12.0+
* Python 2.7 (for erlpack)
@@ -142,6 +142,10 @@ npm start
## Changelog
### 0.7.2
* Fix @everyone replacement
### 0.7.1
* Readme updates
@@ -201,6 +205,6 @@ npm start
* Updated training algorithm and data structure.
# Thanks
## Thanks
Thanks to [BotMaker-for-Discord](https://github.com/CorySanin/BotMaker-for-Discord) which I used as a reference when during development.

View File

@@ -272,8 +272,7 @@ function generateResponse(message: Discord.Message, debug = false, tts = message
fsMarkov.endWords = markovFile.endWords;
try {
const result = fsMarkov.generate(options);
const myResult = result as MarkbotMarkovResult;
const myResult = fsMarkov.generate(options) as MarkbotMarkovResult;
console.log('Generated Result:', myResult);
const messageOpts: Discord.MessageOptions = { tts };
const attachmentRefs = myResult.refs
@@ -289,8 +288,8 @@ function generateResponse(message: Discord.Message, debug = false, tts = message
}
}
myResult.string.replace(/@everyone/g, '@everyοne'); // Replace @everyone with a homoglyph 'o'
message.channel.send(result.string, messageOpts);
myResult.string = myResult.string.replace(/@everyone/g, '@everyοne'); // Replace @everyone with a homoglyph 'o'
message.channel.send(myResult.string, messageOpts);
if (debug) message.channel.send(`\`\`\`\n${JSON.stringify(myResult, null, 2)}\n\`\`\``);
} catch (err) {
console.log(err);

View File

@@ -1,6 +1,6 @@
{
"name": "markbot",
"version": "0.7.1",
"version": "0.7.2",
"description": "A conversational Markov chain bot for Discord",
"main": "index.js",
"scripts": {