Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danik4985 committed Oct 20, 2021
0 parents commit 6172b2a
Show file tree
Hide file tree
Showing 4 changed files with 288 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# I installed @types/node because the code I used for reference for some things needed them
node_modules/
package.json
package-lock.json

# The code I used to see how to use ZLib patcher
# sadly, I can't show you what that is because it is the most disgusting piece of code you can even imagine
# and you would commit suicide after seeing it
skid.ts
21 changes: 21 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 danik4985

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# ChatFilterBypass

> Bypass discord chat filters with ease!
This is a plugin for [BetterDiscord](https://betterdiscord.app/). It lets you bypass discord chat filter bots.

### Disclaimer
**I AM IN NO WAY RESPONSIBLE FOR ANYTHING YOU DO WITH THIS PLUGIN.** I made it because someone asked me to make it. Whatever harm you cause with this is ***not my problem***. Got banned for spamming the n-word in #general? ***NOT MY PROBLEM!*** I think you know where I am going with this...

### Contents
1. [How it works](#how-it-works)
2. [Installation](#installation)
3. [Configuration](#configuration)
4. [Support](#support)
5. [Roadmap](#roadmap)
6. [Contributing](#contributing)
7. [Final words](#final-words)

## How it works
This plugin has replaces letters in your messages with characters that look identical, but are actually different.
For example, it replaces regular `O` (Unicode *004F*) with Cyrilic capital letter `О` (Unicode *041E*), thanks to this, many discord bots don't match your swear words and let you use them.
In case that isn't working on your server, you can also toggle on blatant replacement, which replaces some characters with characters that look similiar, such as `O` => `0`.
And guess what, thats not all! You can also enable zero width space inserting, so that your words are even less likely to be filtered. Just note that this adds one character to your message per <5 letters word and 3 characters to your message for words with 5 or more letters!

## Installation
You can download this plugin from the releases tab of this github repo. Then insert it into your BD plugins folder and enable it.

## Configuration

![The configuration menu](https://cdn.discordapp.com/attachments/733703994018496564/900406852746100776/Screenshot_from_2021-10-20_17-34-51.png)

You can configure this plugin by finding it in the plugin menu and clicking the settings icon, just like you configure any other plugin.
The first free configuration options were already explained in [How it works](#how-it-works), so let me just explain the last one: Prefix.
This option lets you set a prefix that marks that you want to patch the message - let me explain:
If you set your prefix option to `--`, the message will need to start with `--` to be patched. This means that if your message doesnt start with `--`, it won't be modified. This prefix will of course be removed, so if you send
```
--penis
```
it will transform to
```
penis
```

## Support
If you need support, add me on discord: `danik#4985`

## Roadmap
- [ ] Extend the filters
- [ ] Make it possible to send a message starting with the prefix without patching it.
- [ ] Make it more customizable

## Contributing
Please contribute, I need to make the filters larger.

__Contributing rules:__
1. Try to follow my code style
2. When making a PR, please describe what changes you made

## Final words
> They thought I couldn't do this without their help, yet here we are. MUHEHEHEHEHE!
> Filthy betterdiscord discord server members...
Made for educational purpuoses I guess.


(C) danik4985 2021
192 changes: 192 additions & 0 deletions chatfilterbypass.plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
/**
* @name ChatFilterBypass
* @version 0.1.0
* @description Automatically replace cerain letters with characters that look identical but are not to bypass chat filter bots.
* @author danik#4985
*/
class ChatFilterBypass {

#config = {
ghost: true,
blatant: false,
addSpace: false,
prefix: ''
}

#saveConfig() {
BdApi.saveData('chatfilterbypass', 'config', JSON.stringify(this.#config))
}

#loadConfig() {
const fetchedDataRaw = BdApi.loadData('chatfilterbypass', 'config')
const defaultConfig = {
ghost: true,
blatant: false,
addSpace: false,
prefix: ''
}

try {
this.#config = JSON.parse(fetchedDataRaw)
} catch {
BdApi.showToast(
'ChatFilterBypass couldn\'t load your config. This is normal if this is your first time using this plugin. New config will be created!',
{
type: 'warn',
icon: true,
timeout: 3500
}
)

this.#config = defaultConfig
this.#saveConfig()
}
}

start() {
if (!global.ZeresPluginLibrary) {
BdApi.showToast('You need Zere\'s plugin library', {
type: 'error',
icon: true,
timeout: 3500
})

return window.BdApi.alert("Library Missing",`The library plugin needed for ${this.getName()} is missing.<br /><br /> <a href="https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js" target="_blank">Click here to download the library!</a>`)
} else {
ZLibrary.Patcher.after(
'danik.chatfilterbypass.afterSendMessage',
ZLibrary.DiscordModules.MessageActions,
'sendMessage',
(_, _msg) => {
const [, msg] = _msg

console.log(msg)
msg.content = this.#editMessage(msg.content)
}
)

this.#loadConfig()

BdApi.showToast('ChatFilterBypass by danik was activated', {
type: 'success',
icon: true,
timeout: 3500
})
}
}

stop() {
ZLibrary.Patcher.unpatchAll('danik.chatfilterbypass.afterSendMessage')

BdApi.showToast('ChatFilterBypass by danik was deactivated. Bye-bye!', {
type: 'warn',
icon: false,
timeout: 3500
})
}

/**
* Edit the message to bypass chat filters
* @param {string} content
*/
#editMessage(content) {
if (!content.startsWith(this.#config.prefix)) return content

content = content.slice(this.#config.prefix.length)

const EMOJI_REGEX = /<:[a-zA-Z_0-9]+:[0-9]+>/g
const ZWS = '\u{200B}'

const FILTERS_GHOST = {
C: 'С',
c: 'с',
B: 'В',
T: 'Т',
X: 'Х',
x: 'х',
I: 'І',
i: 'і',
O: 'О',
o: 'о'
}

const FILTERS_BLATANT = {
i: '1',
o: '0'
// WIP btw
// someone contribute
// pls
}

const emojiFound = content.match(EMOJI_REGEX) ?? []
const emojiMap = {}

emojiFound.forEach((i, n) => {
content = content.split(i).join(`<:Ř-:${n}>`)
emojiMap[`<:Ř-:${n}>`] = i
})

if (this.#config.ghost) for (const i in FILTERS_GHOST) content = content.split(i).join(FILTERS_GHOST[i])
if (this.#config.blatant) for (const i in FILTERS_BLATANT) content = content.split(i).join(FILTERS_BLATANT[i])
if (this.#config.addSpace) content = content
.split(' ')
.map(i => i.length < 5 ? i[0] + ZWS + i.slice(1) : i[0] + ZWS + i.slice(1, -1) + ZWS + i[i.length - 1])
.join(' ')

for (const i in emojiMap) content = content.split(i).join(emojiMap[i])

return content
}

load() {
BdApi.showToast('Thank you for using ChatFilterBypass by danik', {
type: 'info',
icon: true,
timeout: 3500
})
}

getSettingsPanel() {
return ZLibrary.Settings.SettingPanel.build(
() => {
console.log('A setting has changed')
},
new ZLibrary.Settings.Switch(
'Ghost patching',
'Replace letters with identical ones',
this.#config.ghost,
(v) => {
this.#config.ghost = v
this.#saveConfig()
}
),
new ZLibrary.Settings.Switch(
'Blatant patching',
'Replace letters with similiar characters (such as `i` with `1`)',
this.#config.blatant,
(v) => {
this.#config.blatant = v
this.#saveConfig()
}
),
new ZLibrary.Settings.Switch(
'Add zero width spaces',
'Add zero width spaces to words? This will bypass even more advanced filters, but adds extra 1-3 characters per word.',
this.#config.addSpace,
(v) => {
this.#config.addSpace = v
this.#saveConfig()
}
),
new ZLibrary.Settings.Textbox(
'Message prefix',
'Only patch message when it starts with some prefix, this will remove the prefix. Leave blank to always patch',
this.#config.prefix,
(v) => {
this.#config.prefix = v
this.#saveConfig()
}
)
)
}
}

0 comments on commit 6172b2a

Please sign in to comment.