commit 9f2c6ba7c5e925234f9a3204f119f214a90e7b88 Author: nalydmerc Date: Mon Jan 20 18:22:18 2025 +0000 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..52d9be4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +guptoken.py diff --git a/README b/README new file mode 100644 index 0000000..1a23459 --- /dev/null +++ b/README @@ -0,0 +1,6 @@ +Right now, this requires `guptoken.py` in the same directory to have the function getToken() + +``` +def getToken(): + return "YOURTOKENHERE" +``` \ No newline at end of file diff --git a/example_guptoken.py b/example_guptoken.py new file mode 100644 index 0000000..1a6626a --- /dev/null +++ b/example_guptoken.py @@ -0,0 +1,2 @@ +def getToken(): + return "YOURTOKENHERE" diff --git a/gupbot.py b/gupbot.py new file mode 100644 index 0000000..e2e65e3 --- /dev/null +++ b/gupbot.py @@ -0,0 +1,65 @@ +# bot.py +import os +import random +import discord +import guptoken +import insult_generator + +TOKEN = guptoken.getToken() + +intents = discord.Intents.default() +intents.members = True +client = discord.Client(intents=intents) + +@client.event +async def on_ready(): + print(f'{client.user} has connected to Discord!') + +@client.event +async def on_message(message): + if message.author == client.user: + return + + if message.content.startswith("!insult"): + print(f'Message: {message.content}') + l = message.content.split(" ") + if (len(l) <= 1): + return + + id = 0 + if (l[1].startswith("<@")): + id = int(l[1][2:-1]) + print(f'{id}') + + m = message.channel.members + print(f'Terrrgetted user: {l[1]}') + + print(f'Members: {m}') + for member in m: + print(f'Checking {member.display_name}, {member.id}...') + if (member.display_name.lower() == l[1].lower() or member.id == id): + response = f'{member.mention} is a {insult_generator.hit_me(3, odds_of_adding_another_word=0.75)}!' + await message.channel.send(response) + return + + if (message.content.startswith("!survivor")): + survivors = ["Acrid", "Artificer", "Bandit", "Captain", "Commando", "Engineer", "Huntress", "Loader", "MUL-T", "Mercenary", "REX", "Railgunner", "Void Fiend"] + s = random.choice(survivors) + response = f'{message.author.mention} play {s}, you {insult_generator.hit_me(2)}' + await message.channel.send(response) + return + + if (message.content.startswith("!help")): + response = f'{message.author.mention} go screw yourself, {insult_generator.hit_me(1)}' + await message.channel.send(response) + return + + if (message.content.startswith("!")): + response = f'{message.author.mention} uh, *wat*? For a list of commands, type !help.' + await message.channel.send(response) + return + + + + +client.run(TOKEN) diff --git a/insult_generator.py b/insult_generator.py new file mode 100644 index 0000000..74145e9 --- /dev/null +++ b/insult_generator.py @@ -0,0 +1,342 @@ +import math +import random +import time + +insultingAdjectives = [ + "sweaty", + "big", + "fat", + "dumb", + "stupid", + "goddamn", + "moist", + "mega-", + "turbo-", + "hyper-", + "idiotic", + "worthless", + "flesh-covered", + "uptight", + "poop flinging", + "diseased", + "hairy", + "miserable", + "lonely", + "sad", + "brain-damaged", + "stupendous", + "terminally-online", + "millennial", + "broke-ass", + "braindead", + "fetal alcohol", + "underdeveloped", + "talentless", + "ignorant", + "son-of-a-", + "store-brand", + "irrelevant", + "giant", + "deformed", + "wannabe", + "obsolete", + "old", + "infantile", + "unfunny", + "greasy", + "degenerate", + "lazy", + "slovenly", + "buck-toothed", + "pathetic", + "reptilian", + "absolute", + "feeble-minded", + "effeminate", + "lumpy", + "low-IQ", + "sticky", + "cringey", + "stinky", + "phallic", + "second-class", + "corporate", + "anime-watching", + "wrinkly", + "fugly", + "disposable", + "v-tuber simping", + "desperate", + "sleazy", + "lowly", +] + +adjectivesThatTurnNounsIntoAdjectives = [ + "-obsessed", + "-infested", + "-ass", + "-like", + "-esque", + "-face", + "-bag", + "-sack", + "-shaped", + "-head", + "-smelling", + "-covered", + "-filled", + "-looking-ass", + "less", + "-tuber", +] + +insultingNouns = [ + "egg", + "glue", + "fart", + "diarrhea", + "hair", + "poop", + "doo-doo", + "mother", + "daddy", + "granny", + "pizza", + "baby", + "sewer", + "keeb", + "crotch", + "frog", + "bong", + "3D-printer", + "puppy", + "Funko Pop", + "diaper", + "moustache", + "octopus", + "kitten", + "banana", + "Quagsire", + "pony", + "garbage", + "finger", + "watermelon", + "Bionicle", + "RGB-LED", + "robot", + "sausage", + "uncle", + "goop", + "hobo", + "cigar", + "vape", + "cat", + "spoon", + "nugget", + "taint", + "beer", + "hamster", +] + +nouns_for_you = [ + "meat sack", + "millennial", + "loser", + "peasant", + "oxygen thief", + "waste of space", + "dork", + "nerd", + "dweeb", + "ignoramus", + "knucklehead", + "moron", + "hack", + "psychopath", + "mama's boy", + "virgin", + "disappointment", + "wimp", + "so-and-so", + "degenerate", + "charlatan", + "hack", + "drain on society", + "parasite", + "stain", + "weeaboo", + "creep", + "redneck", + "phony", + "future divorcee", + "sellout", + "noob", +] + +versatile_nouns = [ + "worm", + "douche", + "monkey", + "orangutan", + "wildebeest", + "boomer", + "dog", + "bitch", + "turd", + "booger", + "goblin", + "ass", + "penis", + "hoo-ha", + "sphinchter", + "rodent", + "reptile", + "dipstick", + "neanderthal", + "wiener", + "dingus", + "scum", + "snake", + "weasel", + "donkey", + "bum", + "butt", + "pimple", + "pustule", + "boob", + "amogus", + "corncob", + "nut", + "nozzle", + "redacted", + "donut", +] + +insultingVerbs = [ + "suck", + "lick", + "kick", + "punch", + "cuddl", + "slapp", + "fapp", + "tugg", + "blast", + "snort", + "defil", + "snuggl", + "hump", + "eat", + "lov", + "sniff", + "touch", + "look", + "slurp", + "ogl", + "fondl", + "huff", + "chew", + "spew", + "punt", + "tast", + "grabb", + "strok", + "pucker", + "smooch", + "disappoint", + "hat", + "hoard", + "guzzl", + "pinch", +] + + +def pick_candidate(words, exclusions): + if random.random() < 0.02: + # print('hee hee I broke the rules') + return random.choice(words) + + candidates = [word for word in words if word not in exclusions] + + if len(candidates) == 0: + print('Ran out of words! Reusing one.') + return random.choice(words) + + return random.choice(candidates) + + +def gimme_a_verb(exclusions=""): + return pick_candidate(insultingVerbs, exclusions) + + +def noun_yourself(compound_words_allowed=False, exclusions=""): + dice_roll = random.random() + + if not compound_words_allowed or dice_roll < 0.8: + return pick_candidate(nouns_for_you + versatile_nouns, exclusions) + + elif dice_roll < 0.9: + first_noun = pick_candidate(insultingNouns + versatile_nouns, exclusions) + second_noun = pick_candidate(insultingNouns + versatile_nouns, exclusions + first_noun) + + return f'{first_noun} ' f'{second_noun}' + + else: + noun = noun_something_else(exclusions) + verb = gimme_a_verb(exclusions + noun) + return f'{noun}-{verb}er' + + +def noun_something_else(exclusions=""): + return pick_candidate(insultingNouns + versatile_nouns, exclusions) + + +def get_an_adjective(next_word_is_a_noun, exclusions=""): + if random.random() < 0.75: + if next_word_is_a_noun: + return pick_candidate([word for word in insultingAdjectives if word[-1] != '-'], exclusions) + else: + return pick_candidate(insultingAdjectives, exclusions) + + else: + noun = noun_something_else(exclusions) + + dice_roll = random.randint(0, len(insultingVerbs) + len(adjectivesThatTurnNounsIntoAdjectives)) + + if dice_roll < len(insultingVerbs): + verb = pick_candidate(insultingVerbs, exclusions) + return f'{noun}-{verb}ing' + + else: + adjective = pick_candidate(adjectivesThatTurnNounsIntoAdjectives, exclusions) + return noun + adjective + + +def hit_me(maximum_words=math.inf, exclusions="", odds_of_adding_another_word=0.5): + output = '' + word_count = 1 # Includes the noun + + dice_roll = random.random() + + while word_count < maximum_words and dice_roll < odds_of_adding_another_word: + dice_roll = random.random() + + output += get_an_adjective(dice_roll < odds_of_adding_another_word, exclusions=(output + exclusions)) + if output[-1] is not '-': + output += ' ' + + word_count += 1 + + hyphenated = len(output) > 0 and output[-1] == '-' + output += noun_yourself(compound_words_allowed=(not hyphenated), exclusions=(output + exclusions)) + + return output + + +if __name__ == '__main__': + last_insult = '' + + while True: + last_insult = hit_me(3, exclusions=last_insult, odds_of_adding_another_word=0.75) + print(last_insult) + time.sleep(0.5) \ No newline at end of file