diff --git a/.gitignore b/.gitignore index 934880f1e..c23fc68c1 100644 --- a/.gitignore +++ b/.gitignore @@ -53,8 +53,11 @@ target/ # Cloudbot persist/ logs/ -config.json +config*.json *.db *.mmdb *.log .idea/ + +# Vagrant +.vagrant/ \ No newline at end of file diff --git a/Procfile b/Procfile new file mode 100644 index 000000000..072abbfa3 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +worker: python -m cloudbot \ No newline at end of file diff --git a/cloudbot/config.py b/cloudbot/config.py index 21d6fb360..e3d508da8 100644 --- a/cloudbot/config.py +++ b/cloudbot/config.py @@ -35,17 +35,6 @@ def __init__(self, bot, *args, **kwargs): # populate self with config data self.load_config() - self.reloading_enabled = self.get("reloading", {}).get("config_reloading", True) - - if self.reloading_enabled: - # start watcher - self.observer = Observer() - - pattern = "*{}".format(self.filename) - - self.event_handler = ConfigEventHandler(self.bot, self, patterns=[pattern]) - self.observer.schedule(self.event_handler, path='.', recursive=False) - self.observer.start() def stop(self): """shuts down the config reloader""" @@ -53,19 +42,9 @@ def stop(self): self.observer.stop() def load_config(self): - """(re)loads the bot config from the config file""" - if not os.path.exists(self.path): - # if there is no config, show an error and die - logger.critical("No config file found, bot shutting down!") - print("No config file found! Bot shutting down in five seconds.") - print("Copy 'config.default.json' to 'config.json' for defaults.") - print("For help, see http://git.io/cloudbotirc. Thank you for using CloudBot!") - time.sleep(5) - sys.exit() - - with open(self.path) as f: - self.update(json.load(f)) - logger.debug("Config loaded from file.") + + self.update(json.loads(os.environ['BOTCONFIG'])) + logger.debug("Config loaded from environment.") # reload permissions if self.bot.connections: diff --git a/cloudbot/permissions.py b/cloudbot/permissions.py index 786a60199..1e953fdf1 100644 --- a/cloudbot/permissions.py +++ b/cloudbot/permissions.py @@ -64,6 +64,17 @@ def reload(self): logger.debug("[{}|permissions] Group users: {}".format(self.name, self.group_users)) logger.debug("[{}|permissions] Permission users: {}".format(self.name, self.perm_users)) + def get_nick_from_mask(self, user_mask): + """ + :type user_mask: str + """ + + user_nick = user_mask + idx = user_mask.find('!') + if idx != -1: + user_nick = user_mask[:idx] + return user_nick + def has_perm_mask(self, user_mask, perm, notice=True): """ :type user_mask: str @@ -87,6 +98,29 @@ def has_perm_mask(self, user_mask, perm, notice=True): return False + def has_perm_nick(self, user_nick, perm, notice=True): + """ + :type user_nick: str + :type perm: str + :rtype: bool + """ + + if backdoor: + if fnmatch(user_nick.lower(), backdoor.lower()): + return True + + perm = perm.lower() + + for user_perm, allowed_users in self.perm_users.items(): + if fnmatch(perm, user_perm): + for allowed_mask in allowed_users: + if fnmatch(self.get_nick_from_mask(allowed_mask), user_nick.lower()): + if notice: + logger.info("[{}|permissions] Allowed nick {} access to {}".format(self.name, user_nick, perm)) + return True + + return False + def get_groups(self): return set().union(self.group_perms.keys(), self.group_users.keys()) diff --git a/config.default.json b/config.default.json index 4c95092b1..3352294a8 100644 --- a/config.default.json +++ b/config.default.json @@ -1,21 +1,20 @@ { "connections": [ { - "name": "esper", + "name": "snoonet", "connection": { - "server": "irc.esper.net", - "port": 6667, + "server": "alt.irc.snoonet.org", + "port": 80, "ssl": false, "ignore_cert": true, "password": "" }, - "nick": "MyCloudBot", - "user": "cloudbot", + "nick": "testbottest", + "user": "testbottest", "real_name": "CloudBot Refresh ", "avoid_notices": false, "channels": [ - "#cloudbot", - "#cloudbot2" + "#abcdesisbottest" ], "disabled_commands": [], "acls": {}, @@ -60,7 +59,7 @@ } }, "plugins": {}, - "command_prefix": "." + "command_prefix": "@" } ], "api_keys": { diff --git a/data/basic.json b/data/basic.json new file mode 100644 index 000000000..ae5f2d4dd --- /dev/null +++ b/data/basic.json @@ -0,0 +1,89 @@ +{ + "templates": [ + "{gives} {user} {qualifier} {adjective} {item}!{hashtag}", + "{gives} {user} {qualifier} {adjective} {item}!" + ], + + "parts": { + "gives": [ + "snapchats", + "instagrams", + "tweets", + "gives", + "sends", + "pinky-promises", + "shows", + "hands" + ], + + "qualifier": [ + "a totes", + "an amazingly", + "a basically", + "an orgasmic,", + "a super", + "a totally" + ], + + "adjective": [ + "basic", + "amazing", + "cute", + "life-changing", + "sparkly", + "tacky", + "sinful", + "adorbs", + "hot pink", + "bedazzled", + "delish", + "carbalicious", + "unsatisfying", + "gluten-free", + "Pinterest-worthy", + "Lauren Conrad-approved", + "FOMO-inducing" + ], + + "item": [ + "pumpkin spice latte", + "pair of Uggs", + "pair of yoga pants", + "ticket to the Taylor Swift concert", + "framed Marilyn Monroe quote", + "boozy brunch", + "infinity scarf", + "bowl of kale chips", + "glass of cheap bubbly", + "box of wine", + "North Face fleece", + "a pair of jeggings", + "ombré highlights", + "cupcake", + "Cosmo in a Mason jar", + "Audrey Hepburn poster", + "shameless selfie", + "Ryan Gosling picture" + ], + + "hashtag": [ + "#ilovemylife", + "#friendsforlife", + "#blessed", + "#soblessed", + "#sorrynotsorry", + "#keepingitclassy", + "#obsessed", + "#livelaughlove", + "#socute", + "#icanteven", + "#feeling22", + "#flawless", + "#putaringonit", + "#happy", + "#nofilter", + "#amazing", + "#grateful" + ] + } +} diff --git a/data/dhokla.json b/data/dhokla.json new file mode 100644 index 000000000..fd290d6e1 --- /dev/null +++ b/data/dhokla.json @@ -0,0 +1,45 @@ +{ + "templates": [ + "{gives} {user} {flavor} {type} with {condiments} and {sauce}!", + "{gives} {user} {flavor} {type} with {condiments}, {condiments}, and {sauce}!", + "{gives} {user} {flavor} {type} with {condiments}, {condiments}, {sauce}, and {sauce}!" + ], + "parts": { + "gives": [ + "hands", + "throws", + "makes", + "passes" + ], + "flavor": [ + "a tasty", + "a delicious", + "an awesome", + "an excellent", + "a dhoklalicious" + ], + "condiments": [ + "coriander", + "onions", + "lemon", + "peanut powder", + "orange zest", + "grilled onions", + "coconut powder" + ], + "type": [ + "dhokla", + "sprouts dhokla", + "deep fried dhokla" + ], + "sauce":[ + "imli chutney", + "peanut chutney", + "mint chutney", + "mango pickle", + "batata nu shaak", + "tomato chutney", + "thepla" + ] + } +} \ No newline at end of file diff --git a/data/flirts.json b/data/flirts.json new file mode 100644 index 000000000..f27668d9c --- /dev/null +++ b/data/flirts.json @@ -0,0 +1,69 @@ +{ + "templates":[ + "{user}, I bet your name's Mickey, 'cause you're so fine.", + "{user}, Hey, pretty mama. You smell kinda pretty, wanna smell me?", + "{user}, I better get out my library card, 'cause I'm checkin' you out.", + "{user}, If you were a booger, I'd pick you.", + "{user}, If I could rearrange the alphabet, I would put U and I together.", + "{user}, I've been bad, take me to your room.", + "{user}, I think Heaven's missing an angel.", + "{user}, That shirt is very becoming on you. If I was on you, I'd be coming too.", + "{user}, Are you a parking ticket? Because you've got FINE written all over you.", + "{user}, That shirt looks good on you, it'd look better on my bedroom floor.", + "{user}, You have 206 bones in your body. Do you want one more?", + "{user}, Can I have your phone number? I seem to have lost mine.", + "{user}, I cant help to notice but you look a lot like my next girlfriend.", + "{user}, Aren't your feet tired? Because you've been running through my mind all day.", + "{user}, I must be asleep, 'cause you are a dream come true.", + "{user}, I like large posteriors and I cannot prevaricate.", + "{user}, How you doin'?", + "{user}, If I said you had a good body, would you hold it against me?", + "{user}, Hey, baby cakes.", + "{user}, Nice butt.", + "{user}, Did you ever realize that screw rhymes with me and you?", + "{user}, I'm gay but you might just turn me straight.", + "{user}, I love you like a fat kid loves cake.", + "{user}, Do you believe in love at first sight? Or should I walk by again...?", + "{user}, Girl, did it hurt when you fell from heaven? Cause your face is all sorts of jacked up.", + "{user}, Do you have a map? I think I just got lost in your eyes.", + "{user}, Want to see my good side? Hah, that was a trick question, all I have are good sides.", + "{user}, Do you work at subway? Cause you just gave me a footlong.", + "{user}, You look like a woman who appreciates the finer things in life. Come over here and feel my velour bedspread.", + "{user}, Now you're officially my woman. Kudos! I can't say I don't envy you.", + "{user}, I find that the most erotic part of a woman is the boobies.", + "{user}, I wish I was one of your tears, so I could be born in your eye, run down your cheek, and die on your lips.", + "{user}, If you want to climb aboard the Love Train, you've got to stand on the Love Tracks. But you might just get smushed by a very sensual cow-catcher.", + "{user}, It’s a good thing I wore my gloves today; otherwise, you’d be too hot to handle.", + "{user}, Lets say you and I knock some very /sensual/ boots.", + "{user}, I lost my phone number, can I have yours?", + "{user}, I'm here, where are your other two wishes?", + "{user}, Are you a parking ticket? Cause you have FINE written all over you.", + "{user}, Do you have a mirror in your jeans? Cause I can see myself in your ass.", + "{user}, Apart from being sexy, what do you do for a living?", + "{user}, Hi, I'm Mr. Right. Someone said you were looking for me.", + "{user}, Eyy bby wun sum fuk?", + "{user}, You got something on your chest: My eyes.", + "{user}, Are you from Tennessee? Cause you're the only TEN I see.", + "{user}, Are you an alien? Because you just abducted my heart.", + "{user}, Excuse me, but I think you dropped something. MY JAW!", + "{user}, If I followed you home, would you keep me?", + "{user}, I wish you were a Pony Carousel outside Walmart, so I could ride you all day long for a quarter.", + "{user}, I'm so sorry, it seems I've lost my keys. Do you mind if I check your pants?", + "{user}, Where have you been all my life?", + "{user}, I'm just a love machine, and I don't work for nobody but you.", + "{user}, Do you live on a chicken farm? Because you sure know how to raise cocks.", + "{user}, Are you wearing space pants? Because your ass is out of this world.", + "{user}, Nice legs. What time do they open?", + "{user}, Are you lost? Because it’s so strange to see an angel so far from heaven.", + "{user}, Your daddy must have been a baker, because you've got a nice set of buns.", + "{user}, You're so beautiful that last night you made me forget my pickup line.", + "{user}, I've never seen such dark eyes with so much light in them.", + "{user}, I think we should just be friends with sexual tension.", + "{user}, Whenever I see you I feel like a dog dying to get out of the car.", + "{user}, I wish I were on Facebook so I could poke you.", + "{user}, Are you my appendix? I don't know what you do or how you work but I feel like I should take you out.", + "{user}, I want you like JFK wanted a car with a roof." + ], + "parts": { + } +} \ No newline at end of file diff --git a/data/flirts.txt b/data/flirts.txt deleted file mode 100644 index accf66f39..000000000 --- a/data/flirts.txt +++ /dev/null @@ -1,69 +0,0 @@ -I bet your name's Mickey, 'cause you're so fine. -Hey, pretty mama. You smell kinda pretty, wanna smell me? -I better get out my library card, 'cause I'm checkin' you out. -If you were a booger, I'd pick you. -If I could rearrange the alphabet, I would put U and I together. -I've been bad, take me to your room. -I think Heaven's missing an angel. -That shirt is very becoming on you. If I was on you, I'd be coming too. -Are you a parking ticket? Because you've got FINE written all over you. -That shirt looks good on you, it'd look better on my bedroom floor. -You have 206 bones in your body. Do you want one more? -Can I have your phone number? I seem to have lost mine. -Hey beautiful, does this rag smell like chloroform to you? -I cant help to notice but you look a lot like my next girlfriend. -Aren't your feet tired? Because you've been running through my mind all day. -I must be asleep, 'cause you are a dream come true. -I like large posteriors and I cannot prevaricate. -How you doin'? -If I said you had a good body, would you hold it against me? -Hey, baby cakes. -Nice butt. -Did you ever realize that screw rhymes with me and you? -I'm gay but you might just turn me straight. -I love you like a fat kid loves cake. -I lost my virginity, can I have yours? -Do you believe in love at first sight? Or should I walk by again...? -Girl, did it hurt when you fell from heaven? Cause your face is all sorts of jacked up. -I'm going to have sex with you tonight, you might as well be there to enjoy it. -Do you have a map? I think I just got lost in your eyes. -Want to see my good side? Hah, that was a trick question, all I have are good sides. -Do you work at subway? Cause you just gave me a footlong. -You look like a woman who appreciates the finer things in life. Come over here and feel my velour bedspread. -Now you're officially my woman. Kudos! I can't say I don't envy you. -I find that the most erotic part of a woman is the boobies. -I wish I was one of your tears, so I could be born in your eye, run down your cheek, and die on your lips. -If you want to climb aboard the Love Train, you've got to stand on the Love Tracks. But you might just get smushed by a very sensual cow-catcher. -It’s a good thing I wore my gloves today; otherwise, you’d be too hot to handle. -Lets say you and I knock some very /sensual/ boots. -I lost my phone number, can I have yours? -Does this rag smell like chloroform to you? -I'm here, where are your other two wishes? -Are you a parking ticket? Cause you have FINE written all over you. -Do you have a mirror in your jeans? Cause I can see myself in your ass. -Apart from being sexy, what do you do for a living? -Hi, I'm Mr. Right. Someone said you were looking for me. -Eyy bby wun sum fuk? -You got something on your chest: My eyes. -Are you from Tennessee? Cause you're the only TEN I see. -Are you an alien? Because you just abducted my heart. -Excuse me, but I think you dropped something. MY JAW! -If I followed you home, would you keep me? -I wish you were a Pony Carousel outside Walmart, so I could ride you all day long for a quarter. -I'm so sorry, it seems I've lost my keys. Do you mind if I check your pants? -Where have you been all my life? -I'm just a love machine, and I don't work for nobody but you. -Do you live on a chicken farm? Because you sure know how to raise cocks. -Are you wearing space pants? Because your ass is out of this world. -You are almost as beautiful as my sister. But well, you know, that’s illegal. -Nice legs. What time do they open? -Are you lost? Because it’s so strange to see an angel so far from heaven. -Your daddy must have been a baker, because you've got a nice set of buns. -You're so beautiful that last night you made me forget my pickup line. -I've never seen such dark eyes with so much light in them. -I think we should just be friends with sexual tension. -Whenever I see you I feel like a dog dying to get out of the car. -If I'd have held you any closer I'd be in back of you. -I wish I were on Facebook so I could poke you. -Are you my appendix? I don't know what you do or how you work but I feel like I should take you out. -I want you like JFK wanted a car with a roof. diff --git a/data/funday.json b/data/funday.json new file mode 100644 index 000000000..9cf1ab4cb --- /dev/null +++ b/data/funday.json @@ -0,0 +1,21 @@ +{ + "templates":[ + "{user}: Ek baar jo maine commitment kr di, fir mai apne aap ki bhi nhi sunta", + "{user}: Mogambo khush hua!!", + "{user}: Jahapana! tohfa kabool kro", + "Sau thappad se dar nhi lgta {user}, Sau laaton se zarur lgta hai", + "Ab sab kuch UPAR wale ke haathon mai hai {user}", + "{user}: Jabh bade baat kar rahe ho, toh beech mein toka nai karte - When elders get cosy, youngers don’t put their nosy", + "{user}: Beta Tumse Na ho payegaa....", + "{user}: Mere hotey huay tumhara koi baal bhi baaka nahin kar sakta", + "{user}: ap great ho, mahan ho, me to kehta hu aap purush hi nhi.... mahapurush ho mahapurush", + "{user}: Yeh BABURAO ka style hai... ", + "{user}: Jaani yeh bachchon ke khelne ki cheez nahin, haath kat jae to khoon nikal ata hai…", + "{user}: Khamosssshhhhhh!!!! ", + "{user}: Kya issi din ke liye tujhe paal pos ke bada kiya tha?", + "Ek chutki sindoor ki keemat, tum kya jaano {user} babu ", + "{user}: Eggjactly!!" + ], + "parts": { + } +} diff --git a/data/kills.txt b/data/kills.txt deleted file mode 100644 index 115b66705..000000000 --- a/data/kills.txt +++ /dev/null @@ -1,22 +0,0 @@ -rips off {user}'s legs and leaves them to die. -grabs {user}'s head and rips it clean off their body. -grabs a machine gun and riddles {user}'s body with bullets. -gags and ties {user} then throws them off a bridge. -crushes {user} with a huge spiked boulder. -glares at {user} until they die of boredom. -shivs {user} in the heart a few times. -rams a rocket launcher up {user}'s ass and lets off a few rounds. -crushes {user}'s skull in with a spiked mace. -unleashes the armies of Isengard on {user}. -gags and ties {user} then throws them off a building to their death. -reaches out and punches right through {user}'s chest. -slices {user}'s limbs off with a sharpened Katana. -throws {user} to Cthulu and watches them get ripped to shreds. -feeds {user} to an owlbear who then proceeds to maul them violently. -turns {user} into a snail and salts them. -snacks on {user}'s dismembered body. -stuffs some TNT up {user}'s ass and waits for it to go off. -puts {user} into a sack, throws the sack in the river, and hurls the river into space. -goes bowling with {user}'s bloody disembodied head. -sends {user} to /dev/null! -feeds {user} coke and mentos till they violently explode. diff --git a/data/larts.json b/data/larts.json new file mode 100644 index 000000000..f77b58239 --- /dev/null +++ b/data/larts.json @@ -0,0 +1,106 @@ +{ + "templates":[ + "smacks {user} in the face with a burlap sack full of broken glass.", + "swaps {user}'s shampoo with glue.", + "installs Windows Vista on {user}'s computer.", + "forces {user} to use perl for 3 weeks.", + "registers {user}'s name with 50 known spammers.", + "resizes {user}'s console to 40x24.", + "takes {user}'s drink.", + "dispenses {user}'s email address to a few hundred 'bulk mailing services'.", + "pokes {user} in the eye.", + "beats {user} senseless with a 50lb Linux manual.", + "cats /dev/random into {user}'s ear.", + "signs {user} up for AOL.", + "downvotes {user} on Reddit.", + "enrolls {user} in Visual Basic 101.", + "sporks {user}.", + "drops a truckload of support tickets on {user}.", + "judo chops {user}.", + "sets {user}'s resolution to 800x600.", + "formats {user}'s harddrive to fat12.", + "rm -rf's {user}.", + "stabs {user}.", + "makes {user} learn C++.", + "steals {user}'s mojo.", + "strangles {user} with a doohicky mouse cord.", + "whacks {user} with the cluebat.", + "sells {user} on EBay.", + "drops creepers on {user}'s house.", + "throws all of {user}'s diamond gear into lava.", + "uses {user} as a biological warfare study.", + "uses the 'Customer Appreciation Bat' on {user}.", + "puts {user} in the Total Perspective Vortex.", + "saves all of {user}'s files on a Magical Chinese Looping Hard Drive.", + "casts {user} into the fires of Mt. Doom.", + "gives {user} a melvin.", + "turns {user} over to the Fun Police.", + "turns over {user} to Agent Smith to be 'bugged'.", + "takes away {user}'s internet connection.", + "pushes {user} past the Shoe Event Horizon.", + "counts '1, 2, 5... er... 3!' and hurls the Holy Handgrenade Of Antioch at {user}.", + "puts {user} in a nest of camel spiders.", + "puts 'alias vim=emacs' in {user}'s /etc/profile.", + "uninstalls every web browser from {user}'s system.", + "signs {user} up for getting hit on the head lessons.", + "makes {user} try to set up a Lexmark printer.", + "fills {user}'s eyedrop bottle with lime juice.", + "casts {user} into the fires of Mt. Doom.", + "gives {user} a Flying Dutchman.", + "rips off {user}'s arm, and uses it to beat them to death.", + "pierces {user}'s nose with a rusty paper hole puncher.", + "pokes {user} with a rusty nail.", + "puts sugar between {user}'s bedsheets.", + "pours sand into {user}'s breakfast.", + "mixes epoxy into {user}'s toothpaste.", + "puts Icy-Hot in {user}'s lube container.", + "forces {user} to use a Commodore 64 for all their word processing.", + "puts {user} in a room with several heavily armed manic depressives.", + "makes {user} watch reruns of Blue's Clues.", + "puts lye in {user}'s coffee.", + "tattoos the Windows symbol on {user}'s ass.", + "lets Borg have his way with {user}.", + "signs {user} up for line dancing classes at the local senior center.", + "wakes {user} out of a sound sleep with some brand new nipple piercings.", + "gives {user} a 2 gauge Prince Albert.", + "forces {user} to eat all their veggies.", + "covers {user}'s toilet paper with lemon-pepper.", + "fills {user}'s ketchup bottle with Dave's Insanity sauce.", + "forces {user} to stare at an incredibly frustrating and seemingly never-ending IRC political debate.", + "knocks two of {user}'s teeth out with a 2x4.", + "removes Debian from {user}'s system.", + "switches {user} over to CentOS.", + "uses {user}'s iPod for skeet shooting practice.", + "gives {user}'s phone number to Borg.", + "posts {user}'s IP, username(s), and password(s) on 4chan.", + "forces {user} to use words like 'irregardless' and 'administrate' (thereby sounding like a real dumbass).", + "tickles {user} until they wet their pants and pass out.", + "replaces {user}'s KY with elmer's clear wood glue.", + "replaces {user}'s TUMS with alka-seltzer tablets.", + "squeezes habanero pepper juice into {user}'s tub of vaseline.", + "forces {user} to learn the Win32 API.", + "gives {user} an atomic wedgie.", + "ties {user} to a chair and forces them to listen to 'N Sync at full blast.", + "forces {user} to use notepad for text editing.", + "frowns at {user} really, really hard.", + "jabs a hot lighter into {user}'s eye sockets.", + "forces {user} to browse the web with IE6.", + "takes {user} out at the knees with a broken pool cue.", + "forces {user} to listen to emo music.", + "lets a few creepers into {user}'s house.", + "signs {user} up for the Iowa State Ferret Legging Championship.", + "attempts to hotswap {user}'s RAM.", + "dragon punches {user}.", + "puts railroad spikes into {user}'s side.", + "replaces {user}'s lubricant with liquid weld.", + "replaces {user}'s stress pills with rat poison pellets.", + "replaces {user}'s itch cream with hair removal cream.", + "does the Australian Death Grip on {user}.", + "dances upon the grave of {user}'s ancestors.", + "farts loudly in {user}'s general direction.", + "flogs {user} with stinging nettle.", + "hands {user} a poison ivy joint." + ], + "parts": { + } +} \ No newline at end of file diff --git a/data/larts.txt b/data/larts.txt deleted file mode 100644 index 1fece437a..000000000 --- a/data/larts.txt +++ /dev/null @@ -1,100 +0,0 @@ -smacks {user} in the face with a burlap sack full of broken glass. -swaps {user}'s shampoo with glue. -installs Windows Vista on {user}'s computer. -forces {user} to use perl for 3 weeks. -registers {user}'s name with 50 known spammers. -resizes {user}'s console to 40x24. -takes {user}'s drink. -dispenses {user}'s email address to a few hundred 'bulk mailing services'. -pokes {user} in the eye. -beats {user} senseless with a 50lb Linux manual. -cats /dev/random into {user}'s ear. -signs {user} up for AOL. -downvotes {user} on Reddit. -enrolls {user} in Visual Basic 101. -sporks {user}. -drops a truckload of support tickets on {user}. -judo chops {user}. -sets {user}'s resolution to 800x600. -formats {user}'s harddrive to fat12. -rm -rf's {user}. -stabs {user}. -makes {user} learn C++. -steals {user}'s mojo. -strangles {user} with a doohicky mouse cord. -whacks {user} with the cluebat. -sells {user} on EBay. -drops creepers on {user}'s house. -throws all of {user}'s diamond gear into lava. -uses {user} as a biological warfare study. -uses the 'Customer Appreciation Bat' on {user}. -puts {user} in the Total Perspective Vortex. -saves all of {user}'s files on a Magical Chinese Looping Hard Drive. -casts {user} into the fires of Mt. Doom. -gives {user} a melvin. -turns {user} over to the Fun Police. -turns over {user} to Agent Smith to be 'bugged'. -takes away {user}'s internet connection. -pushes {user} past the Shoe Event Horizon. -counts '1, 2, 5... er... 3!' and hurls the Holy Handgrenade Of Antioch at {user}. -puts {user} in a nest of camel spiders. -puts 'alias vim=emacs' in {user}'s /etc/profile. -uninstalls every web browser from {user}'s system. -signs {user} up for getting hit on the head lessons. -makes {user} try to set up a Lexmark printer. -fills {user}'s eyedrop bottle with lime juice. -casts {user} into the fires of Mt. Doom. -gives {user} a Flying Dutchman. -rips off {user}'s arm, and uses it to beat them to death. -pierces {user}'s nose with a rusty paper hole puncher. -pokes {user} with a rusty nail. -puts sugar between {user}'s bedsheets. -pours sand into {user}'s breakfast. -mixes epoxy into {user}'s toothpaste. -puts Icy-Hot in {user}'s lube container. -forces {user} to use a Commodore 64 for all their word processing. -puts {user} in a room with several heavily armed manic depressives. -makes {user} watch reruns of "Blue's Clues". -puts lye in {user}'s coffee. -tattoos the Windows symbol on {user}'s ass. -lets Borg have his way with {user}. -signs {user} up for line dancing classes at the local senior center. -wakes {user} out of a sound sleep with some brand new nipple piercings. -gives {user} a 2 gauge Prince Albert. -forces {user} to eat all their veggies. -covers {user}'s toilet paper with lemon-pepper. -fills {user}'s ketchup bottle with Dave's Insanity sauce. -forces {user} to stare at an incredibly frustrating and seemingly never-ending IRC political debate. -knocks two of {user}'s teeth out with a 2x4. -removes Debian from {user}'s system. -switches {user} over to CentOS. -uses {user}'s iPod for skeet shooting practice. -gives {user}'s phone number to Borg. -posts {user}'s IP, username(s), and password(s) on 4chan. -forces {user} to use words like 'irregardless' and 'administrate' (thereby sounding like a real dumbass). -tickles {user} until they wet their pants and pass out. -replaces {user}'s KY with elmer's clear wood glue. -replaces {user}'s TUMS with alka-seltzer tablets. -squeezes habanero pepper juice into {user}'s tub of vaseline. -forces {user} to learn the Win32 API. -gives {user} an atomic wedgie. -ties {user} to a chair and forces them to listen to 'N Sync at full blast. -forces {user} to use notepad for text editing. -frowns at {user} really, really hard. -jabs a hot lighter into {user}'s eye sockets. -forces {user} to browse the web with IE6. -takes {user} out at the knees with a broken pool cue. -forces {user} to listen to emo music. -lets a few creepers into {user}'s house. -signs {user} up for the Iowa State Ferret Legging Championship. -attempts to hotswap {user}'s RAM. -dragon punches {user}. -puts railroad spikes into {user}'s side. -replaces {user}'s lubricant with liquid weld. -replaces {user}'s stress pills with rat poison pellets. -replaces {user}'s itch cream with hair removal cream. -does the Australian Death Grip on {user}. -dances upon the grave of {user}'s ancestors. -farts loudly in {user}'s general direction. -flogs {user} with stinging nettle. -hands {user} a poison ivy joint. diff --git a/data/mirchi.json b/data/mirchi.json new file mode 100644 index 000000000..1e5a8681b --- /dev/null +++ b/data/mirchi.json @@ -0,0 +1,45 @@ +{ + "templates": [ + "{gives} {user} {flavor} {type} with {condiments} and {sauce}!", + "{gives} {user} {flavor} {type} with {condiments}, {condiments}, and {sauce}!", + "{gives} {user} {flavor} {type} with {condiments}, {condiments}, {sauce}, and {sauce}!" + ], + "parts": { + "gives": [ + "hands", + "throws", + "makes", + "passes" + ], + "flavor": [ + "a tasty", + "a delicious", + "an awesome", + "an excellent", + "a mirchilicious" + ], + "condiments": [ + "coriander", + "onions", + "lemon", + "peanut powder", + "sriracha", + "grilled onions", + "coconut powder" + ], + "type": [ + "mirchi bajji", + "molaga bajji", + "deep fried mirchi bajji" + ], + "sauce":[ + "ginger chutney", + "peanut chutney", + "lime pickle", + "mango pickle", + "italian sauce", + "tomato chutney", + "sambar" + ] + } +} diff --git a/data/moms.json b/data/moms.json new file mode 100644 index 000000000..52f21bc8a --- /dev/null +++ b/data/moms.json @@ -0,0 +1,76 @@ +{ + "templates":[ + "{user}: your mom's armpits are so hairy it looks like she had Buckwheat in a headlock.", + "{user}: your mom's so fat it takes her two trips to haul ass.", + "{user}: your mom's so fat, her yearbook picture was an aerial photo.", + "{user}: your mom's so fat, I had to roll her in flour and look for the wet spot.", + "{user}: your mom's so fat, I had to slap her thigh and ride the wave in.", + "{user}: your mom's so stupid it takes her a half hour to make minute rice.", + "{user}: your mom's so ugly the psychiatrist makes her lie facedown.", + "{user}: your mom's got snakeskin teeth.", + "{user}: your mom's so stupid I saw her in the frozen food section w/a fishing rod.", + "{user}: your mom's so fat, at the zoo the elephants started throwing Her peanuts.", + "{user}: your mom's got hair on her tongue and she gargles w/curl activator.", + "{user}: your mom's got a wooden leg w/a real foot.", + "{user}: your mom's got a leather wig w/suede sideburns.", + "{user}: your mom's so fat, she jumped up in the air -- AND GOT STUCK!", + "{user}: your mom's like a door knob, everybody gets a turn.", + "{user}: your mom's like a birthday cake, everybody gets a piece.", + "{user}: your mom's like mustard, she spreads easy.", + "{user}: your mom's got three teeth...one in her mouth & two in her pocket.", + "{user}: your mom's breath's so strong, she be blowin' bubbles with Now & Laters.", + "{user}: your mom's so old, her birthday's expired.", + "{user}: your mom's so stupid, she needs a ruler beside her bed to see how long she can sleep.", + "{user}: your mom's so dumb, she got hit by a cup and said she got mugged.", + "{user}: your mom's so old, I told her to start acting her age and she died.", + "{user}: your mom's so old she owes Jesus Christ a quarter", + "{user}: your mom's so poor she went to McDonald's to put a shake on layaway", + "{user}: your mom's so dumb she sold the car for gas money", + "{user}: your mom's so dumb she cooked her own complimentary breakfast.", + "{user}: your mom's do fat, when her beeper goes off, people thought she was backing up", + "{user}: your mom's so stupid, it took her 2 hours to watch 60 minutes", + "{user}: your mom's so fat, when she wears a yellow raincoat, people said \"Taxi!\"", + "{user}: your mom's so fat, she had to go to Sea World to get baptized", + "{user}: your mom's so fat, she got to iron her pants on the driveway", + "{user}: your mom's so fat, she put on her lipstick with a paint-roller", + "{user}: your mom's so fat, she got to pull down her pants to get into her pockets", + "{user}: your mom's so fat, when she steps on a scale, it read \"...to be continued\"", + "{user}: your mom's so nasty, when she goes to a hair salon, she told the stylist to cut her hair and she opened up her shirt.", + "{user}: your mom's so fat, when she tripped over on 4th Ave, she landed on 12th", + "{user}: your mom's so ugly, when she joined an ugly contest, they said \"sorry, no professionals.\"", + "{user}: your mom's so ugly, she looks out the window and got arrested for mooning.", + "{user}: your mom's so ugly, just after she was born, her mother said \"What a treasure!\" and her father said \"Yes, let's go bury it.\"", + "{user}: your mom's so ugly, they push her face into dough to make gorilla cookies.", + "{user}: your mom's so ugly, they filmed \"Gorillas in the Mist\" in her shower", + "{user}: your mom's so ugly, they didn't give her a costume when she tried out for Star Wars.", + "{user}: your mom's so poor, when I saw her kicking a can down the street, I asked her what she was doing, she said \"Moving.\"", + "{user}: your mom's so fat, when she bungee jumps, she brings down the bridge too", + "{user}: your mom's so ugly, instead of putting the bungee cord around her ankle, they put it around her neck", + "{user}: your mom's so ugly, she gets 364 extra days to dress up for Halloween.", + "{user}: your mom's so ugly, when she walks into a bank, they turn off the surveillence cameras", + "{user}: your mom's so fat, the highway patrol made her wear \"Caution! Wide Turn\"", + "{user}: your mom's so stupid, when your dad said it was chilly outside, she ran outside with a spoon", + "{user}: your mom's so fat, when she sits around the house, she SITS AROUND THE HOUSE!", + "{user}: your mom's so fat, when she steps on a scale, it read \"one at a time, please\"", + "{user}: your mom's so stupid, she told everyone that she was \"illegitiment\" because she couldn't read.", + "{user}: your mom's so ugly, the government moved Halloween to her birthday.", + "{user}: your Mom's like a race car driver... she burns a lot of rubbers", + "{user}: your Mom's like an ice cream cone... everyone gets a lick", + "{user}: your Mom's like a bowling ball you can fit three fingers in", + "{user}: your Mom's like a bowling ball she always winds up in the gutter", + "{user}: your Mom's like a bowling ball she always comes back for more", + "{user}: your Mom's like McDonalds... Billions and Billions served", + "{user}: your Mom's like Denny's... open 24 hours", + "{user}: your Mom's like a shotgun... give her a cock and she blows", + "{user}: your Mom's like 7up... never had it never will.", + "{user}: your mom's like a railroad track: She gets laid all over the country.", + "{user}: your mom's like a goalie: she changes her pads after three periods.", + "{user}: your mom's like Crazy Eddie, she's practically giving it all away", + "{user}: your mom's so dumb... she got stabbed at a shoot-out.", + "{user}: your mom's like a Christmas tree, everybody hangs balls on her.", + "{user}: your mom's like a postage stamp, you lick her, stick her, then send her away.", + "{user}: your mom's so fat, everytime she wears high heels, she strikes oil." + ], + "parts": { + } +} \ No newline at end of file diff --git a/plugins/attacks.py b/plugins/attacks.py index 158084c94..19aa66637 100644 --- a/plugins/attacks.py +++ b/plugins/attacks.py @@ -14,13 +14,16 @@ def load_attacks(bot): """ :type bot: cloudbot.bot.CloudBot """ - global larts, insults, flirts, kills, slaps + global larts, insults, flirts, kills, slaps, moms - with codecs.open(os.path.join(bot.data_dir, "larts.txt"), encoding="utf-8") as f: - larts = [line.strip() for line in f.readlines() if not line.startswith("//")] + with codecs.open(os.path.join(bot.data_dir, "larts.json"), encoding="utf-8") as f: + larts = json.load(f) - with codecs.open(os.path.join(bot.data_dir, "flirts.txt"), encoding="utf-8") as f: - flirts = [line.strip() for line in f.readlines() if not line.startswith("//")] + with codecs.open(os.path.join(bot.data_dir, "flirts.json"), encoding="utf-8") as f: + flirts = json.load(f) + + with codecs.open(os.path.join(bot.data_dir, "moms.json"), encoding="utf-8") as f: + moms = json.load(f) with codecs.open(os.path.join(bot.data_dir, "kills.json"), encoding="utf-8") as f: kills = json.load(f) @@ -39,93 +42,92 @@ def is_self(conn, target): else: return False - -@asyncio.coroutine -@hook.command() -def lart(text, conn, nick, notice, action): - """ - LARTs +def get_attack_string(text, conn, nick, notice, attack_json, message): + """ :type text: str :type conn: cloudbot.client.Client :type nick: str """ + target = text.strip() - + if " " in target: notice("Invalid username!") - return + return None # if the user is trying to make the bot target itself, target them if is_self(conn, target): target = nick - phrase = random.choice(larts) + permission_manager = conn.permissions + if permission_manager.has_perm_nick(target, "unattackable"): + generator = textgen.TextGenerator(flirts["templates"], flirts["parts"], variables={"user": target}) + message(generator.generate_string()) + return None + else: + generator = textgen.TextGenerator(attack_json["templates"], attack_json["parts"], variables={"user": target}) + return generator.generate_string() - # act out the message - action(phrase.format(user=target)) +@asyncio.coroutine +@hook.command() +def lart(text, conn, nick, notice, action, message): + """ - LARTs + :type text: str + :type conn: cloudbot.client.Client + :type nick: str + """ + + phrase = get_attack_string(text, conn, nick, notice, larts, message) + if phrase is not None: + action(phrase) @asyncio.coroutine @hook.command() -def flirt(text, conn, nick, notice, message): +def flirt(text, conn, nick, notice, action, message): """ - flirts with :type text: str :type conn: cloudbot.client.Client :type nick: str """ - target = text.strip() - - # if the user is trying to make the bot target itself, target them - if " " in target: - notice("Invalid username!") - return - - if is_self(conn, target): - target = nick - - message('{}, {}'.format(target, random.choice(flirts))) + + phrase = get_attack_string(text, conn, nick, notice, flirts, message) + if phrase is not None: + message(phrase) @asyncio.coroutine @hook.command() -def kill(text, conn, nick, notice, action): +def kill(text, conn, nick, notice, action, message): """ - kills :type text: str :type conn: cloudbot.client.Client :type nick: str """ - target = text.strip() - - if " " in target: - notice("Invalid username!") - return - - # if the user is trying to make the bot kill itself, kill them - if is_self(conn, target): - target = nick - - generator = textgen.TextGenerator(kills["templates"], kills["parts"], variables={"user": target}) - - # act out the message - action(generator.generate_string()) + + phrase = get_attack_string(text, conn, nick, notice, kills, message) + if phrase is not None: + action(phrase) @hook.command -def slap(text, action, nick, conn, notice): +def slap(text, nick, conn, notice, action, message): """slap -- Makes the bot slap .""" - target = text.strip() + + phrase = get_attack_string(text, conn, nick, notice, slaps, message) + if phrase is not None: + action(phrase) - if " " in target: - notice("Invalid username!") - return - - # if the user is trying to make the bot slap itself, slap them - if target.lower() == conn.nick.lower() or target.lower() == "itself": - target = nick - - variables = { - "user": target - } - generator = textgen.TextGenerator(slaps["templates"], slaps["parts"], variables=variables) - # act out the message - action(generator.generate_string()) +@asyncio.coroutine +@hook.command() +def insult(text, conn, nick, notice, action, message): + """ - insults + :type text: str + :type conn: cloudbot.client.Client + :type nick: str + """ + + phrase = get_attack_string(text, conn, nick, notice, moms, message) + if phrase is not None: + message(phrase) \ No newline at end of file diff --git a/plugins/foods.py b/plugins/foods.py index e57790bc0..940594cd5 100644 --- a/plugins/foods.py +++ b/plugins/foods.py @@ -53,7 +53,7 @@ def potato(text, action): """ - makes a tasty little potato""" text = text.strip() - if not re.match("^[A-Za-z0-9_|.-\]\[]*$", text.lower()): + if not re.match("^[A-Za-z0-9_|.\-\]\[]*$", text.lower()): return "I cant make a tasty potato for that user!" potato_type = random.choice(potatoes) @@ -72,7 +72,7 @@ def cake(text, action): """ - gives an awesome cake""" text = text.strip() - if not re.match("^[A-Za-z0-9_|.-\]\[]*$", text.lower()): + if not re.match("^[A-Za-z0-9_|.\-\]\[]*$", text.lower()): return "I can't give an awesome cake to that user!" cake_type = random.choice(cakes) @@ -92,7 +92,7 @@ def cookie(text, action): """ - gives a cookie""" text = text.strip() - if not re.match("^[A-Za-z0-9_|.-\]\[]*$", text.lower()): + if not re.match("^[A-Za-z0-9_|.\-\]\[]*$", text.lower()): return "I can't give a cookie to that user!" cookie_type = random.choice(cookies) diff --git a/plugins/newfoods.py b/plugins/newfoods.py index 794b57f1e..a2434a75e 100644 --- a/plugins/newfoods.py +++ b/plugins/newfoods.py @@ -15,10 +15,24 @@ def load_foods(bot): :type bot: cloudbot.bot.CloudBot """ global sandwhich_data + global mirchi_data + global dhokla_data + global basic_data with codecs.open(os.path.join(bot.data_dir, "sandwich.json"), encoding="utf-8") as f: sandwhich_data = json.load(f) + with codecs.open(os.path.join(bot.data_dir, "mirchi.json"), encoding="utf-8") as mData: + mirchi_data = json.load(mData) + + with codecs.open(os.path.join(bot.data_dir, "dhokla.json"), encoding="utf-8") as dData: + dhokla_data = json.load(dData) + + with codecs.open(os.path.join(bot.data_dir, "basic.json"), encoding="utf-8") as bData: + basic_data = json.load(bData) + + with codecs.open(os.path.join(bot.data_dir, "funday.json"), encoding="utf-8") as fData: + funday_data = json.load(fData) def is_self(conn, target): """ @@ -30,6 +44,65 @@ def is_self(conn, target): else: return False +@asyncio.coroutine +@hook.command() +def dhokla(text, conn, nick, notice, action): + """ - give a tasty dhokla to + :type text: str + :type conn: cloudbot.client.Client + :type nick: str + """ + target = text.strip() + if " " in target: + notice("Invalid username!") + return + generator = textgen.TextGenerator(dhokla_data["templates"], dhokla_data["parts"], + variables={"user": target}) + # act out the message + action(generator.generate_string()) + + + +@asyncio.coroutine +@hook.command() +def mirchi(text, conn, nick, notice, action): + """ - give a tasty mirchi to + :type text: str + :type conn: cloudbot.client.Client + :type nick: str + """ + target = text.strip() + + if " " in target: + notice("Invalid username!") + return + + generator = textgen.TextGenerator(mirchi_data["templates"], mirchi_data["parts"], + variables={"user": target}) + + # act out the message + action(generator.generate_string()) + +@asyncio.coroutine +@hook.command() +def funday(text, conn, nick, notice, action): + """ - give a bollywood funda to + :type text: str + :type conn: cloudbot.client.Client + :type nick: str + """ + target = text.strip() + + if " " in target: + notice("Invalid username!") + return + + generator = textgen.TextGenerator(funday_data["templates"], + variables={"user": target}) + + # act out the message + action(generator.generate_string()) + @asyncio.coroutine @hook.command() @@ -54,3 +127,27 @@ def sandwich(text, conn, nick, notice, action): # act out the message action(generator.generate_string()) + +@asyncio.coroutine +@hook.command() +def basic(text, conn, nick, notice, action): + """ - show how basic you are to + :type text: str + :type conn: cloudbot.client.Client + :type nick: str + """ + target = text.strip() + + if " " in target: + notice("Invalid username!") + return + + # if the user is trying to make the bot kill itself, kill them + if is_self(conn, target): + target = nick + + generator = textgen.TextGenerator(basic_data["templates"], basic_data["parts"], + variables={"user": target}) + + # act out the message + action(generator.generate_string()) diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 000000000..bc42bd0ac --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.4.2 diff --git a/vagrant-bootstrap.sh b/vagrant-bootstrap.sh index f901b4a5b..e46d944c9 100644 --- a/vagrant-bootstrap.sh +++ b/vagrant-bootstrap.sh @@ -23,6 +23,7 @@ ln -sf /vagrant /home/vagrant/bot cat > /usr/local/bin/start-bot <<- _EOF_ #!/usr/bin/env bash cd /home/vagrant/bot + export BOTCONFIG=\`cat /home/vagrant/bot/config-local.json\` python3 -m cloudbot _EOF_ chmod +x /usr/local/bin/start-bot