diff --git a/README.md b/README.md index 65cdaf8..56e2f57 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/index.ts b/index.ts index 93b3cb7..6379fcc 100644 --- a/index.ts +++ b/index.ts @@ -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); diff --git a/package.json b/package.json index f9de28f..e8ecd48 100644 --- a/package.json +++ b/package.json @@ -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": {