This repository has been archived by the owner on Dec 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from cedricouellet/develop
censorship removed, browser notifs fixed, refactor, zalgo usernames
- Loading branch information
Showing
8 changed files
with
65 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Detects if a string contains Zalgo text. | ||
* @param {string} str The string to test. | ||
* @return {boolean} If the string contains Zalgo or not. | ||
*/ | ||
function isZalgo(str) { | ||
if (str.length === 0) return false; | ||
|
||
const reg = new RegExp(/([aeiouy]\u0308)|[\u0300-\u036f\u0489]/, "gi"); | ||
const charBites = str.match(/[\s\S]{1,3}/g).length; | ||
let rawScore = 0; | ||
|
||
str.split("").forEach(char => { | ||
if (reg.test(char)) rawScore++; | ||
}); | ||
|
||
return rawScore / charBites >= 1; | ||
} | ||
|
||
module.exports = isZalgo; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const {BOT_NAME} = require('./constants'); | ||
|
||
/** | ||
* Generate a message coming from the server. | ||
* @param {string} message The message to send. | ||
* @return {{sender: string, text: string}} The message object containing the sender and text. | ||
*/ | ||
function generateServerMessage(message) { | ||
return { | ||
sender: BOT_NAME, | ||
text: message, | ||
}; | ||
} | ||
|
||
module.exports = { | ||
generateServerMessage, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters