diff --git a/Shitpost.py b/Shitpost.py index 417dc5a..3c1c13e 100644 --- a/Shitpost.py +++ b/Shitpost.py @@ -18,6 +18,8 @@ class Shitpost(object): self.bot = bot self.voice_states = {} self.hdConImpatientEvents = [] + self.zwarte_lijst = [line.rstrip('\n') for line in open('black.txt')] + self.witte_lijst = [line.rstrip('\n') for line in open('white.txt')] # nihao self.insult = ['koekenbakker','stumperd','knurft','oelewapper','klungel','stoethaspel', 'onnozelaar','beunhaas','uilskuiken','bamibal','zwakzinnige','oenemeloen', 'prutser','domkop','non-valeur','ontzettende debiel','paljas','simpeltje', @@ -566,6 +568,49 @@ class Shitpost(object): return max(1.0, min(10.0, grade)) + @commands.command(pass_context=True) + @asyncio.coroutine + def ktdm(self, ctx, *args): + '''Speel Kaarten Tegen De Mensheid! Genereer een kaart of geef zelf opties. + Bijvoorbeeld: !ktdm <"1"><"2"><"3"> (aanbevolen 1 of 2, max 3)''' + random.shuffle(self.witte_lijst) # schudden voor gebruik + zwarte_kaart = random.choice(self.zwarte_lijst).replace("___", "{}") # kies en maak het juiste format + aantal_wit = zwarte_kaart.count("{}") # tel hoeveel witte kaarten er nodig zijn + if aantal_wit == 0: # Soms staat er geen ___ in de kaart + zwarte_kaart = zwarte_kaart + " {}" + aantal_wit = 1 + arg_count = len(args) + if arg_count > 3: + yield from ctx.channel.send(ctx.author.mention + ", " + random.choice(insult) + ", 3 is het maximum.") + elif arg_count > 0: + for elem in args: + self.witte_lijst.append(elem) + + if arg_count != 0: # Indien extra args gegeven + while arg_count != aantal_wit: # Match het aantal args aan het aantal dat nodig is + zwarte_kaart = random.choice(self.zwarte_lijst).replace("___", "{}") + aantal_wit = zwarte_kaart.count("{}") + + wit={} # maak dynamisch dict aan met de witte kaarten die ingevuld worden + for x in range(aantal_wit, 0, -1): + key = "wit" + str(x) + wit[key] = self.witte_lijst.pop() + + # Dit gedeelte print de zwarte kaart mooi af + if aantal_wit == 1: + print(zwarte_kaart.format(wit['wit1'])) + yield from ctx.channel.send(ctx.author.mention + "\n" + zwarte_kaart.format(wit['wit1'])) + elif aantal_wit == 2: + print(zwarte_kaart.format(wit['wit1'],wit['wit2'])) + yield from ctx.channel.send(ctx.author.mention + "\n" + zwarte_kaart.format(wit['wit1'],wit['wit2'])) + elif aantal_wit == 3: + print(zwarte_kaart.format(wit['wit1'],wit['wit2'],wit['wit3'])) + yield from ctx.channel.send(ctx.author.mention + "\n" + zwarte_kaart.format(wit['wit1'],wit['wit2'],wit['wit3'])) + else: + print("Dit is een vreemd aantal witte kaarten: " + str(aantal_wit) + "\nDe boosdoener: " + zwarte_kaart) + yield from ctx.channel.send("Arme " + random.choice(insult) + ", er is iets foutgegaan!") + yield from ctx.message.delete() + @commands.command(pass_context=True) @asyncio.coroutine def beledig(self, ctx, member:discord.User):