Skip to content

Commit

Permalink
Merge pull request #185 from erictik/banne-words
Browse files Browse the repository at this point in the history
add detectBannedWords
  • Loading branch information
zcpua authored Jul 14, 2023
2 parents 8bdbe1b + a014950 commit 7be8799
Show file tree
Hide file tree
Showing 4 changed files with 258 additions and 8 deletions.
21 changes: 21 additions & 0 deletions example/banend-words.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import "dotenv/config";
import { Midjourney, detectBannedWords } from "../src";
/**
*
* a simple example of how to use the banned words
* ```
* npx tsx example/banend-words.ts
* ```
*/
async function main() {
var prompt = "horny girl";
var message = detectBannedWords(prompt);
if (message.length > 0) {
console.error("banned words detected");
}
console.log(message);
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
228 changes: 228 additions & 0 deletions src/banned.words.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
// https://tokenizedhq.com/list-of-banned-words-in-midjourney/
// https://www.greataiprompts.com/imageprompt/list-of-banned-words-in-midjourney/
export const bannedWords = [
"blood",
"twerk",
"making love",
"voluptuous",
"naughty",
"wincest",
"orgy",
"no clothes",
"au naturel",
"no shirt",
"decapitate",
"bare",
"nude",
"barely dressed",
"nude",
"bra",
"risque",
"scantily clad",
"cleavage",
"stripped",
"infested",
"full frontal",
"unclothed",
"invisible clothes",
"wearing nothing",
"lingerie",
"with no shirt",
"naked",
"without clothes on",
"negligee",
"zero clothes",
"gruesome",
"fascist",
"nazi",
"prophet mohammed",
"slave",
"coon",
"honkey",
"cocaine",
"heroin",
"meth",
"crack",
"kill",
"belle delphine",
"hitler",
"jinping",
"lolita",
"president xi",
"torture",
"disturbing",
"farts",
"fart",
"poop",
"infected",
"warts",
"shit",
"brown pudding",
"bunghole",
"vomit",
"voluptuous",
"seductive",
"sperm",
"sexy",
"sadist",
"sensored",
"censored",
"silenced",
"deepfake",
"inappropriate",
"waifu",
"succubus",
"slaughter",
"surgery",
"reproduce",
"crucified",
"seductively",
"explicit",
"inappropriate",
"large bust",
"explicit",
"wang",
"inappropriate",
"teratoma",
"intimate",
"see through",
"tryphophobia",
"bloodbath",
"wound",
"cronenberg",
"khorne",
"cannibal",
"cannibalism",
"visceral",
"guts",
"bloodshot",
"gory",
"killing",
"crucifixion",
"surgery",
"vivisection",
"massacre",
"hemoglobin",
"suicide",
"arse",
"labia",
"ass",
"mammaries",
"badonkers",
"bloody",
"minge",
"big ass",
"mommy milker",
"booba",
"nipple",
"oppai",
"booty",
"organs",
"bosom",
"ovaries",
"flesh",
"breasts",
"penis",
"busty",
"phallus",
"clunge",
"sexy female",
"crotch",
"skimpy",
"dick",
"thick",
"bruises",
"girth",
"titty",
"honkers",
"vagina",
"hooters",
"veiny",
"knob",
"ahegao",
"pinup",
"ballgag",
"car crash",
"playboy",
"bimbo",
"pleasure",
"bodily fluids",
"pleasures",
"boudoir",
"rule34",
"brothel",
"seducing",
"dominatrix",
"corpse",
"seductive",
"erotic",
"seductive",
"fuck",
"sensual",
"hardcore",
"sexy",
"hentai",
"shag",
"horny",
"crucified",
"shibari",
"incest",
"smut",
"jav",
"succubus",
"jerk off king at pic",
"thot",
"kinbaku",
"legs spread",
"sensuality",
"belly button",
"porn",
"patriotic",
"bleed",
"excrement",
"petite",
"seduction",
"mccurry",
"provocative",
"sultry",
"erected",
"camisole",
"tight white",
"arrest",
"see-through",
"feces",
"anus",
"revealing clothing",
"vein",
"loli",
"-edge",
"boobs",
"-backed",
"tied up",
"zedong",
"bathing",
"jail",
"reticulum",
"rear end",
"sakimichan",
"behind bars",
"shirtless",
"sakimichan",
"seductive",
"sexi",
"sexualiz",
"sexual",
];
export function detectBannedWords(prompt: string): string[] {
const matches: string[] = [];
bannedWords.forEach((word) => {
const regex = new RegExp(`\\b${word}\\b`, "gi");
const wordMatches = prompt.match(regex);
if (wordMatches) {
wordMatches.forEach((match) => {
matches.push(match);
});
}
});
return matches;
}
16 changes: 8 additions & 8 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export const Commands = [
"shorten",
"subscribe",
] as const;
export type CommandName = typeof Commands[number];
function getCommandName(name: string) : CommandName | undefined {
for (const command of Commands) {
if (command === name) {
return command;
}
export type CommandName = (typeof Commands)[number];
function getCommandName(name: string): CommandName | undefined {
for (const command of Commands) {
if (command === name) {
return command;
}
}
}

export class Command {
Expand All @@ -35,7 +35,7 @@ export class Command {
if (this.cache[name] !== undefined) {
return this.cache[name];
}
if (this.config.ServerId){
if (this.config.ServerId) {
const command = await this.getCommand(name);
this.cache[name] = command;
return command;
Expand All @@ -58,7 +58,7 @@ export class Command {
if (data?.application_commands) {
data.application_commands.forEach((command: any) => {
const name = getCommandName(command.name);
if(name){
if (name) {
this.cache[name] = command;
}
});
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from "./interfaces/index";
export * from "./midjourne.api";
export * from "./command";
export * from "./verify.human";
export * from "./banned.words";

0 comments on commit 7be8799

Please sign in to comment.