From a8b397a44f12db1db6338f7167a7a476112af148 Mon Sep 17 00:00:00 2001 From: Russell Date: Fri, 15 Mar 2019 10:20:44 -0400 Subject: [PATCH] Update things, delete things, add things --- .tracery/aphorism | 609 --------------------- .tracery/guid | 8 - .tracery/mission | 29 - Code/irc/README.md | 9 + Code/irc/banterbot_plugins/botlist.py | 8 + Code/irc/banterbot_plugins/crime.py | 9 + Code/irc/banterbot_plugins/fight.py | 7 + Code/irc/banterbot_plugins/help.py | 9 + Code/irc/banterbot_plugins/randomThings.py | 8 + Code/irc/banterbot_plugins/rhymes.py | 1 + Code/irc/banterbot_plugins/wisdom.py | 9 + Code/irc/bot_launcher.py | 4 + Code/irc/data/tildejackpot.txt | 2 +- Code/irc/data/tildescores.txt | 65 ++- Code/irc/quote_bot.py | 113 ---- Code/irc/run_banter.sh | 4 +- Code/irc/systemd/banterbot.service | 15 + Code/irc/systemd/madlibbot.service | 15 + Code/irc/systemd/tildebot.service | 2 +- Code/irc/systemd/topicbot.service | 15 + Code/irc/team_launcher.py | 69 +++ Code/irc/util/chopra.py | 8 + Code/irc/util/fightCrime.py | 8 + Code/irc/util/newAge.py | 8 + Code/irc/util/quote_puzzle.py | 18 +- Code/irc/util/randomThings.py | 34 ++ Code/irc/util/tilde.py | 44 +- Code/irc/util/tropes.py | 15 + public_html/chatcloud/index.html | 2 + public_html/data/du_log.json | 2 +- public_html/index.html | 1 + 31 files changed, 347 insertions(+), 803 deletions(-) delete mode 100644 .tracery/aphorism delete mode 100644 .tracery/guid delete mode 100644 .tracery/mission create mode 100644 Code/irc/README.md create mode 100644 Code/irc/banterbot_plugins/botlist.py create mode 100644 Code/irc/banterbot_plugins/crime.py create mode 100644 Code/irc/banterbot_plugins/help.py create mode 100644 Code/irc/banterbot_plugins/randomThings.py create mode 100644 Code/irc/banterbot_plugins/wisdom.py delete mode 100755 Code/irc/quote_bot.py create mode 100755 Code/irc/systemd/banterbot.service create mode 100755 Code/irc/systemd/madlibbot.service create mode 100755 Code/irc/systemd/topicbot.service create mode 100755 Code/irc/team_launcher.py create mode 100644 Code/irc/util/chopra.py create mode 100644 Code/irc/util/fightCrime.py create mode 100644 Code/irc/util/newAge.py create mode 100644 Code/irc/util/randomThings.py create mode 100644 Code/irc/util/tropes.py diff --git a/.tracery/aphorism b/.tracery/aphorism deleted file mode 100644 index 9cfd111..0000000 --- a/.tracery/aphorism +++ /dev/null @@ -1,609 +0,0 @@ -{ - "origin": ["#aphorism.capitalize#."], - - "aphorism": [ - "#adjective.a# #money# #continuanc# #verb.s# #direction#", - "#verb.a#ing #animal# #continuance# #verb.s#", - "#animal.a# in the #bodypart# is #preposition# #number# in the #plant#", - "#noun.a# is only as #adjective# as its #comparative# #noun#", - "#animal.a# is #person.a#'s #comparative# #relation#", - "#person.a# and #pronoun_possessive# #money# are #adverb# #verb#ed", - "#adjective.a# #noun# is the #noun# of #comparative# #noun.s#", - "#person.a# in #verb# is #person.a# #adverb#", - "#comparative.a# #noun# makes #comparative.a# #noun#", - "#person.a# of #adjective# #noun.s# is #person# of #adjective#", - "#noun.a# #preposition# #verb#ing is #preposition# #verb#ing #adverb#", - "#comparative.a# #noun# is a #adjective# thing", - "#person.a# is known by the #person# #pronoun# #verb.s#", - "#person.a# with #number# #noun# knows what #noun# it is. #person.a.capitalize# with #number# #noun.s# is #continuance# #adjective#", - "#person.a#'s #noun# is #pronoun_possessive# #noun#", - "#noun.a# is as #comparative# as #distance.a#", - "#adjective.a# #noun# #verb.s# #adjective#", - "#noun.a# is as #adjective# as #noun.a# to #adjective.a# #person#", - "#money.a# #verb#ed is #money.a# #verb#ed", - "#location.a# for everything and everything in its #location#", - "#verb.a#ing #noun# #verb.s# #adjective# #noun.s#", - "#noun.a# by any other #noun# would #verb# as #adjective#", - "#adjective.a# #noun# #verb#eth #direction# #noun#", - "#noun.a# in #noun# #verb.s# #number#", - "#noun.a# of #noun# is a #noun# #adverb#", - "#verb.a#ed #noun# #adverb# #verb.s#", - "#person.a#'s #noun# is in the #location#", - "#person.a#'s #noun# is #adverb# done.", - "#noun.a# to the #adjective# is #adjective#", - "#noun# #verb.s# the #noun# #verb# #adjective#", - "#noun.s# #verb# #adjective# than #noun.s#", - "#adjective# for #number# and #number# for #adjective#", - "#adjective# that #verb.s# is not #noun#", - "#adjective# the #location#'s a #noun#", - "#adjective# #noun.s# #verb# to #pronoun# who #verb.s#", - "#adjective# we #verb# from #noun# is that we #verb# #adverb# from #noun#", - "#adjective# #noun# and #adjective# #noun# #verb.s# #person.capitalize# #adjective.a# #noun#", - "#adjective#'s #adjective# in #noun# and #noun#", - "#adjective#'s #adverb# that #verb.s# #adverb#" - ], - - "adjective": [ - "all", - "bad", - "blind", - "clean", - "dangerous", - "dull", - "fair", - "fonder", - "foolish", - "louder", - "new", - "no", - "none", - "soft", - "strong", - "sufficient", - "sure", - "sweet", - "wise" - ], - - "adverb": [ - "forever", - "indeed", - "never", - "nothing", - "soon", - "well" - ], - - "animal": [ - "bird", - "dog", - "man" - ], - - "bodypart": [ - "hand" - ], - - "comparative": [ - "best", - "good", - "little", - "weakest" - ], - - "continuance": [ - "always", - "never" - ], - - "direction": [ - "away", - "up", - "down" - ], - - "distance": [ - "mile" - ], - - "location": [ - "castle", - "home", - "place", - "world" - ], - - "money": [ - "money", - "penny" - ], - - "noun": [ - "action", - "absence", - "answer", - "beauty", - "beginning", - "boat", - "boy", - "broom", - "castle", - "chain", - "clock", - "consistency", - "ending", - "gold", - "heart", - "history", - "home", - "joy", - "learning", - "link", - "love", - "mind", - "miss", - "moss", - "name", - "nod", - "place", - "pot", - "rose", - "stitch", - "stage", - "stone", - "thing", - "tide", - "time", - "trade", - "war", - "wink", - "word", - "work", - "wrath" - ], - - "number": [ - "one", - "two", - "nine" - ], - - "person": [ - "company", - "fool", - "friend", - "hobgoblin", - "jack", - "man", - "master", - "woman" - ], - - "plant": [ - "bush" - ], - - "preposition": [ - "worth" - ], - - "pronoun": [ - "he" - ], - - "pronoun_possessive": [ - "his" - ], - - "relation": [ - "friend" - ], - - "verb": [ - "boil", - "come", - "do", - "earn", - "end", - "gather", - "glitter", - "grow", - "keep", - "learn", - "lift", - "make", - "need", - "part", - "rise", - "roll", - "save", - "smell", - "speak", - "sweep", - "turn", - "watch" - ], - - "todo": [ - "Always cut the cards.", - "An apple a day keeps the doctor away.", - "An army marches on its stomach.", - "An ounce of prevention is worth a pound of cure.", - "Any port in a storm.", - "Anything that can go wrong, will go wrong.", - "Appearances can be deceiving.", - "April showers bring May flowers.", - "As you sow, so shall you reap.", - "Ask a silly question and you'll get a silly answer.", - "Ask and it shall be given.", - "Ask and you shall receive.", - "Ask no questions and hear no lies.", - "Bad news travels fast.", - "Barking dogs seldom bite.", - "Be careful you don't go from the frying pan into the fire.", - "Be it ever so humble, there's no place like home.", - "Be not penny wise and pound foolish.", - "Beauty is in the eye of the beholder.", - "Beauty is only skin deep.", - "Before you judge a man, you should walk a mile in his shoes.", - "Beggars can't be choosers.", - "Behind every successful man is a woman.", - "Better late than never.", - "Better safe than sorry.", - "Better the devil you know than the devil you don't.", - "Better to have loved and lost, than never to have loved at all.", - "Better to light a candle than to curse the darkness.", - "Beware of Greeks bearing gifts.", - "Birds of a feather flock together.", - "Blood is thicker than water.", - "Boys will be boys.", - "Brevity is the soul of wit.", - "Build a better mousetrap and the world will beat a path to your door.", - "Business before pleasure.", - "Candy is dandy but liquor is quicker.", - "Carpe diem ... seize the day.", - "Cast your bread upon the water, and it will be returned a hundred-fold.", - "Chickens will come home to roost.", - "Children should be seen and not heard.", - "Cleanliness is next to godliness.", - "Cold hands, warm heart.", - "Common sense is not so common.", - "Cream always rises to the top.", - "Crime does not pay.", - "Discretion is the better part of valor.", - "Do as I say, not as I do.", - "Do unto others as you would have them do unto you.", - "Don't bite off more than you can chew.", - "Don't bite the hand that feeds you.", - "Don't burn the candle at both ends.", - "Don't burn your bridges behind you.", - "Don't change horses in midstream.", - "Don't close the barn door after the horse runs away.", - "Don't count your chickens before they hatch.", - "Don't cry over spilt milk.", - "Don't cut off your nose to spite your face.", - "Don't fire until you see the whites of their eyes.", - "Don't foul your own nest.", - "Don't give up the ship.", - "Don't hide your light under a bushel.", - "Don't judge a book by its cover.", - "Don't kill the goose that lays the golden eggs.", - "Don't look a gift horse in the mouth.", - "Don't make mountains out of molehills.", - "Don't put all your eggs in one basket.", - "Don't put the cart before the horse.", - "Don't shoot the messenger.", - "Don't speak ill of the dead.", - "Don't spit into the wind.", - "Don't take any wooden nickels.", - "Don't throw out the baby with the bath water.", - "Don't throw pearls before swine.", - "Doubt is the beginning, not the end, of wisdom.", - "Early to bed, early to rise, makes a man healthy, wealthy and wise.", - "Easier said than done.", - "East is East, and West is West, and never the twain shall meet.", - "East or West, home is best.", - "Easy come, easy go.", - "Eat to live, don't live to eat.", - "Eat, drink and be merry, for tomorrow we die.", - "Even a broken clock is right twice a day.", - "Every cloud has a silver lining.", - "Every dog has his day.", - "Every man has a price.", - "Everybody talks about the weather, but nobody does anything about it.", - "Expect the unexpected.", - "Experience is the best teacher.", - "Faith will move mountains.", - "Familiarity breeds contempt.", - "Feed a cold, starve a fever.", - "Finders keepers, losers weepers.", - "First come, first served.", - "Flattery will get you nowhere.", - "Fools rush in where angels fear to tread.", - "For want of a nail, a kingdom was lost.", - "Forewarned is forearmed.", - "Forgive and forget.", - "Forgive them, for they know not what they do.", - "Frailty, thy name is woman!", - "From the sublime to the ridiculous is but a step.", - "Gather ye rosebuds while ye may.", - "Genius is one percent inspiration and 99 percent perspiration.", - "Give a man a fish and he eats for one night. Teach him how and he eats for life.", - "Give him an inch and he'll take a mile.", - "Give him enough rope and he'll hang himself.", - "Give me liberty, or give me death.", - "Give the devil his due.", - "God helps those who help themselves.", - "Good fences make good neighbors.", - "Good gifts come in small packages.", - "Great minds think alike.", - "Great oaks from little acorns grow.", - "Grin and bear it.", - "Half a loaf is better than none.", - "Handsome is as handsome does.", - "Haste makes waste.", - "He that is not with me is against me.", - "He who fights and runs away, lives to fight another day.", - "He who hesitates is lost.", - "He who laughs last, laughs best.", - "He who lives by the sword shall die by the sword.", - "He who pays the piper calls the tune.", - "Hell hath no fury like a woman scorned.", - "Here today, gone tomorrow.", - "History repeats itself.", - "Hitch your wagon to a star.", - "Home is where the heart is.", - "Honesty is the best policy.", - "Hope springs eternal in the human breast.", - "Hunger is the best sauce.", - "I think, therefore I am.", - "Idle hands are the devil's workshop.", - "If at first you don't succeed, try, try again.", - "If it's not broke, don't fix it.", - "If it's not one thing, it's another.", - "If the mountain won't come to Mohammed, then Mohammed will go to the mountain.", - "If the shoe fits, wear it.", - "If wishes were fishes then no man would starve.", - "If wishes were horses, then beggars would ride.", - "If you can't beat them, join them.", - "If you can't stand the heat, get out of the kitchen.", - "If you do what you've always done you'll get what you've always got.", - "If you lie down with dogs, you wake up with fleas.", - "If you snooze, you lose.", - "Ignorance is bliss.", - "Ignoriance of the law is no excuse for breaking it.", - "Imitation is the sincerest form of flattery.", - "In for a penny, in for a pound.", - "In the country of the blind, the one-eyed man is king.", - "In the spring a young man's fancy lightly turns to thoughts of love.", - "It never rains but it pours.", - "It takes a thief to catch a thief.", - "It takes two to tango.", - "It'll all come out in the wash.", - "It's an ill wind that blows no good.", - "It's every man for himself.", - "It's never too late to mend.", - "It's no use beating a dead horse.", - "It's not over till it's over.", - "It's not over until the fat lady sings.", - "It's not the heat, it's the humidity.", - "It's not the knowing that is difficult, but the doing.", - "It's not whether you win or lose, but how you play the game.", - "It's the empty can that makes the most noise.", - "It's the squeaky wheel that gets the grease.", - "It's time to fish or cut bait.", - "Keep a stiff upper lip.", - "Keep your eyes peeled.", - "Keep your fingers crossed.", - "Keep your head above water.", - "Keep your nose to the grindstone.", - "Keep your powder dry.", - "Know thyself.", - "Know which side your bread is buttered on.", - "Knowledge is power.", - "Laugh, and the world laughs with you; weep, and you weep alone.", - "Laughter is the best medicine.", - "Leave no stone unturned.", - "Leave well enough alone.", - "Let bygones be bygones.", - "Let he who is without sin cast the first stone.", - "Let nature takes its course.", - "Let sleeping dogs lie.", - "Let's cross the bridge when we come to it.", - "Life is short, art is long.", - "Lightning never strikes twice in the same place.", - "Little pitchers have big ears.", - "Little strokes fell great oaks.", - "Live and learn.", - "Live and let live.", - "Live every day as if it were your last.", - "Look before you leap.", - "Love conquers all.", - "Love is blind.", - "Love makes the world go 'round.", - "Make a virtue of necessity.", - "Make haste slowly.", - "Make hay while the sun shines.", - "Man cannot live by bread alone.", - "Man proposes, God disposes.", - "Many are called but few are chosen.", - "Many hands make light work.", - "Marry in haste, repent at leisure.", - "Might makes right.", - "Mind your P's and Q's.", - "Misery loves company.", - "Money isn't everything.", - "Murder will out.", - "Music hath charms to soothe the savage breast.", - "Nature abhors a vacuum.", - "Necessity is the mother of invention.", - "Never give a sucker an even break.", - "Never judge a book by its cover.", - "Never put off until tomorrow what you can do today.", - "Never say die.", - "No good deed goes unrewarded.", - "No man can serve two masters.", - "No man is an island.", - "No news is good news.", - "No pain, no gain.", - "Nothing is certain but death and taxes.", - "Nothing succeeds like success.", - "Nothing ventured, nothing gained.", - "Oil and water don't mix.", - "Old habits die hard.", - "Once bitten, twice shy.", - "One good turn deserves another.", - "One man's loss is another man's gain.", - "One man's meat is another man's poison.", - "One picture is worth a thousand words.", - "One rotten apple spoils the barrel.", - "Only the wearer knows where the shoe pinches.", - "Opportunity never knocks twice.", - "Opposites attract.", - "Out of sight, out of mind.", - "People who live in glass houses shouldn't throw stones.", - "Politics makes strange bedfellows.", - "Possession is nine-tenths of the law.", - "Power corrupts; absolute power corrupts absolutely.", - "Practice makes perfect.", - "Practice what you preach.", - "Pride goeth before a fall.", - "Procrastination is the thief of time.", - "Rats desert a sinking ship.", - "Revenge is a dish best eaten cold.", - "Revenge is sweet.", - "Rome wasn't built in a day.", - "Seeing is believing.", - "Seek and ye shall find.", - "Share and share alike.", - "Silence is golden.", - "Sink or swim.", - "Slow but steady wins the race.", - "Spare the rod and spoil the child.", - "Still waters run deep.", - "Stone walls do not a prison make.", - "Strike while the iron is hot.", - "Take the bitter with the sweet.", - "Take the bull by the horns.", - "That's life.", - "That's the way the ball bounces.", - "The apple doesn't fall far from the tree.", - "The bad workman always blames his tools.", - "The best things in life are free.", - "The best-laid plans of mice and men often go awry.", - "The bigger they come, the harder they fall.", - "The burnt child shuns the fire.", - "The child is the father of the man.", - "The course of true love never did run smooth.", - "The devil can cite Scripture for his purpose.", - "The early bird gets the worm.", - "The end justifies the means.", - "The eyes are the windows to the soul.", - "The grass is always greener on the other side.", - "The hotter the battle, the sweeter the victory.", - "The leopard cannot change its spots.", - "The longest journey begins with but a single footstep.", - "The love of money is the root of all evil.", - "The meek shall inherit the earth.", - "The more the merrier.", - "The more things change, the more they stay the same.", - "The pen is mightier than sword.", - "The quality of mercy is not strained.", - "The proof of the pudding is in the eating.", - "The race isn't always to the swift, nor the fight to the strong, but that's the way to bet.", - "The road to Hell is paved with good intentions.", - "The sea refuses no river.", - "The show must go on.", - "The truth will out.", - "The teacher appears when the student is ready.", - "The turtle only makes progress when it sticks its neck out.", - "The walls have ears.", - "The way to a man's heart is through his stomach.", - "The wish is father of the deed.", - "There ain't no such thing as a free lunch.", - "There are plenty of fish in the sea.", - "There are old soldiers, and bold soldiers, but there are no old, bold soldiers.", - "There are two sides to every question.", - "There is nothing good or bad but thinking makes it so.", - "There's a first time for everything.", - "There's many a slip 'twixt the cup and the lip.", - "There's method in his madness.", - "There's more than one way to skin a cat.", - "There's no accounting for taste.", - "There's no defense like a good offense.", - "There's no disputing about taste.", - "There's no fool like an old fool.", - "There's no place like home.", - "There's no rest for the wicked.", - "There's no such thing as a free lunch.", - "There's nothing new under the sun.", - "There's something rotten in Denmark.", - "There, but for the grace of God, go I.", - "Things aren't always what they seem.", - "This too shall pass.", - "Those who cannot remember the past are condemned to repeat it.", - "Time and tide wait for no man.", - "Time heals all wounds.", - "Time is money.", - "Time is of the essence.", - "To err is human, to forgive divine.", - "Too many cooks spoil the broth.", - "Truth is stranger than fiction.", - "Turn the other cheek.", - "Turnabout is fair play.", - "Two heads are better than one.", - "Two wrongs don't make a right.", - "Two's company, three's a crowd.", - "Uneasy lies the head that wears a crown.", - "Variety is the spice of life.", - "Waste not, want not.", - "Water seeks its own level.", - "Well begun is half done.", - "We're too soon old and too late smart.", - "What can't be cured must be endured.", - "What goes around, comes around.", - "What goes up, must come down.", - "What will be, will be.", - "What's good for the goose is good for the gander.", - "When all you have are lemons, make lemonade.", - "When in Rome, do as the Romans do.", - "When it rains, it pours.", - "When the cat's away, the mice will play.", - "When the going gets tough, the tough get going.", - "When your only tool is a hammer, every problem looks like a nail.", - "Where there's a will, there's a way.", - "Where there's smoke, there's fire.", - "While there's life, there's hope.", - "Who pays the piper calls the tune.", - "Winners never quit and quitters never win.", - "You can catch more flies with honey than with vinegar.", - "You can fool some of the people all of the time, and all of the people some of the time, but you can't fool all of the people all of the time.", - "You can kill a man but you can't kill an idea.", - "You can lead a horse to water, but you can't make it drink.", - "You can take the boy out of the country, but you can't take the country out of the boy.", - "You can't fight city hall.", - "You can't fit a round peg in a square hole.", - "You can't get the toothpaste back in the tube.", - "You can't go home again.", - "You can't have your cake and eat it too.", - "You can't make a silk purse out of a sow's ear.", - "You can't make an omelet without breaking eggs.", - "You can't squeeze blood from a turnip.", - "You can't take it with you.", - "You can't teach an old dog new tricks.", - "You can't tell a book by its cover.", - "You can't unring a bell.", - "You can't unscramble an egg.", - "You don't get something for nothing.", - "You get what you pay for.", - "You have to take the bitter with the sweet.", - "You have to take the good with the bad.", - "You made your bed, now lie in it.", - "You need to stop to smell the roses.", - "You need to take a bull by the horns, and a man by his word.", - "You pays your money and you takes your choice.", - "You're never too old to learn." - ] - -} - diff --git a/.tracery/guid b/.tracery/guid deleted file mode 100644 index 067238d..0000000 --- a/.tracery/guid +++ /dev/null @@ -1,8 +0,0 @@ -{ - "origin": ["#guid#"], - "guid": ["#eightchar#-#fourchar#-#fourchar#-#twelvechar#"], - "fourchar": ["#char##char##char##char#"], - "eightchar": ["#fourchar##fourchar#"], - "twelvechar": ["#eightchar##fourchar#"], - "char": ["1","2","3","4","5","6","7","8","9","0","a","b","c","d","e","f"] -} diff --git a/.tracery/mission b/.tracery/mission deleted file mode 100644 index 05f83db..0000000 --- a/.tracery/mission +++ /dev/null @@ -1,29 +0,0 @@ -{ - "origin": ["#prefix##mission.capitalize#"], - - "adj": ["Ancient","Bold","Breaking","Brightest","Brilliant","Crescent","Dark|Darkness","Darkest|Darkness","Desert|Desert","Eternal","Evening|Darkness","Final","First","Forever","Giant|Giant","Glorious|Glory","Joyful|Joy","July","Last","Liberty|Liberty","Magic|Magic","Morning|Morning","Power|Power","Phantom","Present","Righteous","Roaring|Roar|Scream","Rolling","Sand","Screaming|Roar|Scream","Silent","Sleeping","Soaring","Standing|Stand","Star|Star","Stunning","Super","Thunderous|Thunder","Twisted","Urgent","Utopian","Valiant"], - "noun": ["Action","Alert","Bane","Beauty","Claw","Darkness","Dawn","Day","Defense","Desert","Envy","Fall","Fist","Flight","Fury","Guard","Glory","Hammer","Hand","Honor","Hope","Hunt","Hurricane","Joy","Liberty","Light","Lightning","Magic","Morning","October","Power","Rain","Response","Repose","Roar","Scream","Skull","Sky","Skies","Shield","Shout","Stand","Star","Storm","Streak","Strike","Sun","Thunder","Victory","Whisper","Wind","Wrath"], - "color": ["Black","Blue","Brown","Golden","Gray","Green","Indego","Orange","Purple","Rainbow","Red","Scarlet","Silver","Violet","White","Yellow"], - "actor": ["Cobra","Condor","Dragon","Eagle","Giant","Guardian","Hawk","Hydra","Jackal","King","Knight","Lady","Lion","Scorpion","Spartan","Stranger","Titan","Victor","Viking","Warrior"], - "prefix": [ - "", - "Operation ", - "Project ", - "Code: " - ], - "mission": [ - "#adj# #noun#", - "#adj# #actor#", - "#color# #noun#", - "#color# #actor#", - "#actor#'s #noun#", - "#noun# of the #actor#", - "#actor# of the #noun#", - "#noun# of #noun#", - "#noun# of #color# #noun#", - "#adj# #noun# and #adj# #noun#", - "Attack of the #actor.s#", - "Return of the #actor.s#", - "The #actor# Awakens" - ] -} diff --git a/Code/irc/README.md b/Code/irc/README.md new file mode 100644 index 0000000..8fa5b68 --- /dev/null +++ b/Code/irc/README.md @@ -0,0 +1,9 @@ +These are some bots that I've written using the pinhook framework +* banterbot +* tildebot +* topicbot +* madlibbot +* numberwangbot + +Bots are kicked off by the generic bot_launcher.py through systemd services. +You could also write a manual script that encapsulates these config options. diff --git a/Code/irc/banterbot_plugins/botlist.py b/Code/irc/banterbot_plugins/botlist.py new file mode 100644 index 0000000..7e5baad --- /dev/null +++ b/Code/irc/banterbot_plugins/botlist.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 + +import pinhook.plugin + +@pinhook.plugin.register('!botlist') +def rollcall_plugin(msg): + text = "I am owned and run by {}".format(",".join(msg.ops)) + return pinhook.plugin.message(text) diff --git a/Code/irc/banterbot_plugins/crime.py b/Code/irc/banterbot_plugins/crime.py new file mode 100644 index 0000000..d6f3a7e --- /dev/null +++ b/Code/irc/banterbot_plugins/crime.py @@ -0,0 +1,9 @@ +#!/usr/bin/python3 + +import pinhook.plugin +import util.fightCrime + +@pinhook.plugin.register('!crime') +def crime_plugin(msg): + message = util.fightCrime.getDuo() + return pinhook.plugin.message(message) diff --git a/Code/irc/banterbot_plugins/fight.py b/Code/irc/banterbot_plugins/fight.py index a735126..779aca0 100644 --- a/Code/irc/banterbot_plugins/fight.py +++ b/Code/irc/banterbot_plugins/fight.py @@ -1,8 +1,15 @@ #!/usr/bin/python3 import pinhook.plugin +import time @pinhook.plugin.listener('fight') def fight_plugin(msg): if msg.botnick + ": " in msg.text: return pinhook.plugin.message("u want some of this, m8?") + +@pinhook.plugin.listener('action') +def action_plugin(msg): + if msg.botnick in msg.text and hasattr(msg, 'event') and msg.event is "action": + time.sleep(1) + msg.action(msg.channel, msg.text.replace(msg.botnick, msg.nick) + " back") diff --git a/Code/irc/banterbot_plugins/help.py b/Code/irc/banterbot_plugins/help.py new file mode 100644 index 0000000..43a9226 --- /dev/null +++ b/Code/irc/banterbot_plugins/help.py @@ -0,0 +1,9 @@ +#!/usr/bin/python3 + +import pinhook.plugin + +@pinhook.plugin.register('!help2') +def help_plugin(msg): + # just a placeholder to overload the built-in !help function + if msg.nick in msg.ops: + return pinhook.plugin.message("!help has been disabled") diff --git a/Code/irc/banterbot_plugins/randomThings.py b/Code/irc/banterbot_plugins/randomThings.py new file mode 100644 index 0000000..c2b9116 --- /dev/null +++ b/Code/irc/banterbot_plugins/randomThings.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 + +import pinhook.plugin +from util import randomThings + +@pinhook.plugin.register('!random') +def acronym_plugin(msg): + return pinhook.plugin.message(randomThings.getRandom(msg.arg)) diff --git a/Code/irc/banterbot_plugins/rhymes.py b/Code/irc/banterbot_plugins/rhymes.py index 7690414..fdbf47f 100644 --- a/Code/irc/banterbot_plugins/rhymes.py +++ b/Code/irc/banterbot_plugins/rhymes.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 import pinhook.plugin +import random from util import rhymesWith poetic_file = "/home/nossidge/poems/words_poetic.txt" diff --git a/Code/irc/banterbot_plugins/wisdom.py b/Code/irc/banterbot_plugins/wisdom.py new file mode 100644 index 0000000..c01b175 --- /dev/null +++ b/Code/irc/banterbot_plugins/wisdom.py @@ -0,0 +1,9 @@ +#!/usr/bin/python3 + +import pinhook.plugin +import util.chopra + +@pinhook.plugin.register('!wisdom') +def wisdom_plugin(msg): + message = util.chopra.getWisdom() + return pinhook.plugin.message(message) diff --git a/Code/irc/bot_launcher.py b/Code/irc/bot_launcher.py index 380ccf0..4b2f57b 100755 --- a/Code/irc/bot_launcher.py +++ b/Code/irc/bot_launcher.py @@ -1,5 +1,9 @@ #!/usr/bin/python3 +# This is a generic launcher that acts as a chasis for various bots +# I would recomend creating a separate script that can be invoked +# directly for each bot you run + import argparse from pinhook.bot import Bot diff --git a/Code/irc/data/tildejackpot.txt b/Code/irc/data/tildejackpot.txt index 597975b..bf0d87a 100644 --- a/Code/irc/data/tildejackpot.txt +++ b/Code/irc/data/tildejackpot.txt @@ -1 +1 @@ -35 \ No newline at end of file +4 \ No newline at end of file diff --git a/Code/irc/data/tildescores.txt b/Code/irc/data/tildescores.txt index 41cc9a0..aab7f6f 100644 --- a/Code/irc/data/tildescores.txt +++ b/Code/irc/data/tildescores.txt @@ -1,8 +1,8 @@ -krowbar&^%2745&^%1548770703.413761 +krowbar&^%2854&^%1552509758.872889 karlen&^%498&^%1527613440 endorphant&^%809&^%1444775660 jumblesale&^%25&^%1426171214 -marcus&^%2578&^%1538071912 +marcus&^%2578&^%1549650312.011321 papa&^%181&^%1474509971 epicmorphism&^%15&^%1546280322 audy&^%83&^%1504564254 @@ -40,9 +40,9 @@ xkeeper&^%201&^%1539193279 cosnok&^%807&^%1508878859 escobar&^%1&^%1475431401 amicabot&^%30&^%1481225205 -caff&^%1030&^%1540040705 +caff&^%1032&^%1552346661.160125 kadin&^%19&^%1541514839 -desvox&^%59&^%1548198585 +desvox&^%69&^%1551716946.90284 mankins&^%3&^%1480211581 cinch&^%2&^%1480454755 caffbot&^%969&^%1532662872 @@ -50,14 +50,14 @@ evilbot&^%4&^%1480693919 tybaltcat&^%7&^%1481076625 Minerbot&^%328&^%1548433782 mio&^%347&^%1529720473 -tehfraga&^%673&^%1547260565 +tehfraga&^%811&^%1552634200.805025 sushi&^%10&^%1493253212 troido&^%303&^%1548409580 -gamebot&^%336&^%1548409599 -nilaky&^%1759&^%1548459568 +gamebot&^%419&^%1552404970.041536 +nilaky&^%1968&^%1552624002.376977 bucket&^%103&^%1507931139 lolbot&^%1&^%1502568407 -m455&^%12&^%1512076715 +m455&^%12&^%1550095510.913918 abraxas&^%3&^%1500665540 nilakybot&^%7&^%1503006301 greely&^%70&^%1509386334 @@ -67,9 +67,9 @@ pinhook&^%8&^%1509744722 emfor&^%3&^%1509671353 k2l8m11n2&^%11&^%1510932395 sacredpixel&^%3&^%1522082931 -login&^%3276&^%1548698114 +login&^%3669&^%1552632831.452062 kelpiebot&^%3&^%1513101957 -unreal&^%2&^%1534387108 +unreal&^%4&^%1550140674.610166 kinsey&^%26&^%1520446672 testgameb&^%2&^%1537604954 erin&^%2&^%1517681999 @@ -77,14 +77,14 @@ wuz&^%3&^%1518125300 hashdang&^%4&^%1518666906 ubergeek&^%63&^%1530410162 silver&^%9&^%1519333029 -equa&^%53&^%1534373756 +equa&^%94&^%1552602770.059508 audiodude&^%2&^%1519453927 whimsy&^%47&^%1529678733 -wangofett&^%286&^%1548446486 +wangofett&^%294&^%1552436276.341388 saturn&^%3&^%1521429369 lucidiot&^%28&^%1526201925 tracer&^%1&^%1521744878 -jan6&^%1359&^%1548771222.440076 +jan6&^%1396&^%1550244555.585356 eeeeeta&^%55&^%1540361066 cmccabe&^%81&^%1529698164 carbon&^%9&^%1524135505 @@ -93,10 +93,10 @@ Halian&^%32&^%1528360263 lunasspecto&^%4&^%1524164784 severak&^%17&^%1546438400 ralph&^%4&^%1526980620 -von&^%490&^%1548233084 +von&^%497&^%1551951799.571028 ensis&^%1750&^%1546853217 simon&^%26&^%1527937489 -benharri&^%3276&^%1548695613 +benharri&^%3744&^%1552656758.814522 cpb&^%3&^%1528930564 calmbit&^%160&^%1541625694 wisebot&^%5652&^%1539612163 @@ -105,37 +105,46 @@ ninlenna&^%6&^%1531186900 x4464&^%1&^%1532028546 pounce&^%19&^%1532133325 livix&^%7&^%1533603142 -ben&^%3&^%1533767627 -npa&^%326&^%1548659103 +ben&^%3&^%1551976138.688011 +npa&^%467&^%1552622753.295706 ezo&^%6&^%1533883842 aliasless&^%36&^%1541001821 -kirch&^%492&^%1548773313.169501 +kirch&^%717&^%1552517847.310872 root&^%2&^%1535558514 byte&^%5&^%1536416308 qbe&^%7&^%1537850181 informativeheck&^%3&^%1536733938 h00fi&^%1&^%1537050053 -fantoro&^%57&^%1542125611 +fantoro&^%59&^%1550270271.196303 tildethief&^%7421&^%1542132794 -benjaminwil&^%581&^%1548377274 -deltawitch&^%3453&^%1548462217 -archangelic&^%484&^%1541101297 -diodelass&^%3&^%1539382302 -minerobber&^%420&^%1548433750 +benjaminwil&^%612&^%1552337192.892643 +deltawitch&^%3551&^%1552602506.535836 +archangelic&^%492&^%1551543505.698955 +diodelass&^%11&^%1550243960.964821 +minerobber&^%424&^%1550645545.053616 brendantcc&^%3&^%1539908223 dozens&^%21&^%1541090333 bowlercaptain&^%6&^%1540926135 nicole&^%6&^%1541276844 littlebigly&^%49&^%1541283119 -ahriman&^%636&^%1548663037 -tunas&^%114&^%1545848648 +ahriman&^%808&^%1552634685.217617 +tunas&^%115&^%1551455658.637688 netscape_navigator&^%5&^%1545846867 roan&^%5&^%1545846612 ckipp01&^%3&^%1545813774 -ben&^%3&^%1545800958 +ben&^%4&^%1551976138.688011 l0010o0001l&^%3&^%154529473 rgdrake&^%1&^%1546086404 handyc&^%5&^%1546456002 -fosslinux&^%10&^%1548661962 +fosslinux&^%37&^%1550379331.325722 banterbot&^%3&^%1547588758 testgamebot&^%4&^%1547722176 +minerobber2&^%56&^%1552364229.599098 +minerbot&^%113&^%1552404981.997855 +desvox__&^%2&^%1549262081.083705 +roy&^%121&^%1551697915.426383 +diodelasses&^%19&^%1551139645.230519 +asdf&^%47&^%1552038120.672267 +Kneezle&^%1&^%1551975324.060361 +strdg&^%2&^%1551967813.490182 +kneezle&^%6&^%1552213173.813114 diff --git a/Code/irc/quote_bot.py b/Code/irc/quote_bot.py deleted file mode 100755 index 8f1cc20..0000000 --- a/Code/irc/quote_bot.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/python -# http://wiki.shellium.org/w/Writing_an_IRC_bot_in_Python - -# Import some necessary libraries. -import socket -import os -import sys -from optparse import OptionParser - -import util - -parser = OptionParser() - -parser.add_option( - "-s", - "--server", - dest="server", - default="127.0.0.1:6667", - help="the server to connect to", - metavar="SERVER", -) -parser.add_option( - "-c", - "--channel", - dest="channel", - default="#tildetown", - help="the channel to join", - metavar="CHANNEL", -) -parser.add_option( - "-n", - "--nick", - dest="nick", - default="quotebot", - help="the nick to use", - metavar="NICK", -) - -(options, args) = parser.parse_args() - - -def random_quote(channel): - quote = os.popen("/home/frs/quotes/randquote.py").read() - if len(quote) >= 256: - quote = quote[:253] + "..." - util.sendmsg(ircsock, channel, quote) - - -def haiku(channel): - h = os.popen("haiku").read().replace("\n", " // ") - util.sendmsg(ircsock, channel, h) - - -def say_mentions(user, message): - nick = util.get_user_from_message(message) - menschns = ( - os.popen("/home/karlen/bin/mensch -u {} -t 24 -z +0".format(user)) - .read() - .replace("\t", ": ") - .split("\n") - ) - for mention in menschns: - if not "" == mention: - toSend = "PRIVMSG " + nick + " :" + mention + "\n" - if len(toSend) >= 256: - toSend = toSend[:253] + "..." - ircsock.send(toSend) - - -def say_chatty(channel): - chattyOut = os.popen("/home/karlen/bin/chatty").read().split("\n") - for line in chattyOut: - if line: - util.sendmsg(ircsock, channel, line) - - -def listen(): - while 1: - - ircmsg = ircsock.recv(2048).decode("utf-8") - ircmsg = ircmsg.strip("\r\n") - - formatted = util.format_message(ircmsg) - - if "" == formatted: - continue - - print(formatted) - - user = formatted.split("\t")[1] - - if ircmsg.find(":!quote") != -1: - random_quote(options.channel) - - if ircmsg.find(":!mentions") != -1: - say_mentions(user, ircmsg) - - if ircmsg.find(":!chatty") != -1: - say_chatty(options.channel) - - if ircmsg.find(":!haiku") != -1: - haiku(options.channel) - - if ircmsg[:4] == "PING": - util.ping(ircsock, ircmsg) - - sys.stdout.flush() - # time.sleep(1) - - -ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -util.connect(ircsock, options) -listen() diff --git a/Code/irc/run_banter.sh b/Code/irc/run_banter.sh index 2b52756..b859dd3 100755 --- a/Code/irc/run_banter.sh +++ b/Code/irc/run_banter.sh @@ -2,8 +2,8 @@ # check if the bot is already running if [[ ! `pidof -sx bot_launcher.py` || ! `ps -p $(pidof -sx bot_launcher.py) -o args | grep "\-n banterbot"` ]]; then echo "Starting banterbot" - /home/krowbar/Code/irc/bot_launcher.py -n banterbot -s 127.0.0.1 -p 6667 -c \#tildetown \#bots - # nohup /home/krowbar/Code/irc/bot_launcher.py -n banterbot -s 127.0.0.1:6667 -c \#bot_test + #/home/krowbar/Code/irc/bot_launcher.py -n banterbot -s 127.0.0.1 -p 6667 -c \#tildetown \#bots + /home/krowbar/Code/irc/bot_launcher.py -n banterbot -s 127.0.0.1 -p 6667 -c \#bots else echo "Banterbot has already been started" fi diff --git a/Code/irc/systemd/banterbot.service b/Code/irc/systemd/banterbot.service new file mode 100755 index 0000000..0b43f1a --- /dev/null +++ b/Code/irc/systemd/banterbot.service @@ -0,0 +1,15 @@ +[Unit] +Description=banterbot daemon +After=banterbot.service + +[Service] +Type=simple +ExecStart=/home/krowbar/Code/irc/bot_launcher.py -s 127.0.0.1 -p 6667 -n banterbot -c #tildetown #bots +WorkingDirectory=/home/krowbar/Code/irc/ +Restart=always +RestartSec=5 +StartLimitInterval=60s +StartLimitBurst=3 + +[Install] +WantedBy=default.target diff --git a/Code/irc/systemd/madlibbot.service b/Code/irc/systemd/madlibbot.service new file mode 100755 index 0000000..4a5291d --- /dev/null +++ b/Code/irc/systemd/madlibbot.service @@ -0,0 +1,15 @@ +[Unit] +Description=madlibbot daemon +After=madlibbot.service + +[Service] +Type=simple +ExecStart=/home/krowbar/Code/irc/madlibbot/madlibbot.py -s 127.0.0.1:6667 -n madlibbot -c #bots #madlibs +WorkingDirectory=/home/krowbar/Code/irc/ +Restart=always +RestartSec=5 +StartLimitInterval=60s +StartLimitBurst=3 + +[Install] +WantedBy=default.target diff --git a/Code/irc/systemd/tildebot.service b/Code/irc/systemd/tildebot.service index d44a791..f537579 100644 --- a/Code/irc/systemd/tildebot.service +++ b/Code/irc/systemd/tildebot.service @@ -4,7 +4,7 @@ After=tildebot.service [Service] Type=simple -ExecStart=/home/krowbar/Code/irc/tildebot.py -n tildebot -c \#tildetown +ExecStart=/home/krowbar/Code/irc/bot_launcher.py -n tildebot -s 127.0.0.1 -p 6667 -c #bots WorkingDirectory=/home/krowbar/Code/irc/ Restart=always RestartSec=5 diff --git a/Code/irc/systemd/topicbot.service b/Code/irc/systemd/topicbot.service new file mode 100755 index 0000000..101cdc6 --- /dev/null +++ b/Code/irc/systemd/topicbot.service @@ -0,0 +1,15 @@ +[Unit] +Description=topicbot daemon +After=topicbot.service + +[Service] +Type=simple +ExecStart=/home/krowbar/Code/irc/banterbot.py -s 127.0.0.1 -p 6667 -n topicbot -c #bot_test +WorkingDirectory=/home/krowbar/Code/irc/ +Restart=always +RestartSec=5 +StartLimitInterval=60s +StartLimitBurst=3 + +[Install] +WantedBy=default.target diff --git a/Code/irc/team_launcher.py b/Code/irc/team_launcher.py new file mode 100755 index 0000000..c11cac4 --- /dev/null +++ b/Code/irc/team_launcher.py @@ -0,0 +1,69 @@ +#!/usr/bin/python3 + +# This is a generic launcher that acts as a chasis for various bots +# I would recomend creating a separate script that can be invoked +# directly for each bot you run + +import argparse +from pinhook.bot import Bot + +parser = argparse.ArgumentParser() + +parser.add_argument( + "-s", + "--server", + dest="server", + default="127.0.0.1", + help="the server to connect to", + metavar="SERVER", +) +parser.add_argument( + "-p", + "--port", + dest="port", + type=int, + default=6667, + help="the port to connect to", + metavar="PORT", +) +parser.add_argument( + "-c", + "--channels", + dest="channels", + nargs="+", + default=["#bot_test"], + help="the channels to join", + metavar="CHANNELS", +) +parser.add_argument( + "-n", + "--nick", + dest="nick", + default="banterbot", + help="the nick to use", + metavar="NICK", +) +parser.add_argument( + "-o", + "--owners", + dest="owners", + nargs="+", + default=["krowbar"], + help="the owners of this bot", + metavar="OWNERS", +) + +args = parser.parse_args() +print(args) + +bot = Bot( + channels = args.channels, + nickname = args.nick, + ops = args.owners, + plugin_dir = "{}_plugins".format(args.nick), + server = args.server, + port = args.port + ) + +if __name__ == "__main__": + bot.start() diff --git a/Code/irc/util/chopra.py b/Code/irc/util/chopra.py new file mode 100644 index 0000000..bc4a717 --- /dev/null +++ b/Code/irc/util/chopra.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 +import requests +from bs4 import BeautifulSoup + +def getWisdom(): + url = "http://www.wisdomofchopra.com/iframe.php" + html = BeautifulSoup(requests.get(url).content, "html.parser") + return html.find("td", { "id": "quote" }).text diff --git a/Code/irc/util/fightCrime.py b/Code/irc/util/fightCrime.py new file mode 100644 index 0000000..11ef16b --- /dev/null +++ b/Code/irc/util/fightCrime.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 +import requests +from bs4 import BeautifulSoup + +def getDuo(): + url = "https://www.theyfightcrime.org/" + html = BeautifulSoup(requests.get(url).content, "html.parser") + return html.findAll('p')[1].text diff --git a/Code/irc/util/newAge.py b/Code/irc/util/newAge.py new file mode 100644 index 0000000..999c9ff --- /dev/null +++ b/Code/irc/util/newAge.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 +import requests +from bs4 import BeautifulSoup + +def ReionizeElectrons(): + url = "http://sebpearce.com/bullshit/" + html = BeautifulSoup(requests.get(url).content, "html.parser") + return html.findAll('p')[1].text diff --git a/Code/irc/util/quote_puzzle.py b/Code/irc/util/quote_puzzle.py index 67388a6..2183bd9 100644 --- a/Code/irc/util/quote_puzzle.py +++ b/Code/irc/util/quote_puzzle.py @@ -6,22 +6,32 @@ import random import re quotefile = "/home/karlen/irc/quotes.txt" +wordsfile = "/usr/share/dict/words" chuckfile = "/home/krowbar/Code/irc/data/chuck.txt" chuckApi = "https://api.icndb.com/jokes/random" def get_quote(): quotes = open(quotefile, "r").read().split("---") quote, attr = random.choice(quotes).strip().splitlines() + attempt = 10 + dict_words = open(wordsfile).read().split() + while True: + good_words = [w for w in quote.split() if w in dict_words and len(w) > 2] + if len(good_words) > 3 or attempt is 0: + break #either we got a good one or we gave up + quote, attr = random.choice(quotes).strip().splitlines() + attempt = attempt - 1 + quote = quote[:200] # get only the first 200 chars - word = random.choice([q for q in quote.split(" ") if len(q) > 1]) + word = random.choice([q for q in quote.split() if len(q) > 2 and q in dict_words] or [q for q in quote.split() if len(q) > 1]) quote = quote.replace(word, re.sub(r"[a-zA-Z]", "_", word)) - return [word, 'Fill in the blank: "' + quote + '" ' + attr] + return [word, 'Fill in the blank: "{}" {}'.format(quote, attr)] def get_chuck(): #chucks = open(chuckfile, "r").readlines() #chuck = random.choice(chucks).rstrip()[:200] # get only the first 200 chars - # ha ha! let's see if we can confus login + # ha ha! let's see if we can confuse login chuck = json.loads(requests.get(chuckApi).content.decode())['value']['joke'][:200] word = random.choice([w for w in chuck.split(" ") if len(w) > 1 and w.lower() != "chuck" and w.lower() != "norris"]) chuck = chuck.replace(word, re.sub(r"[a-zA-Z]", "_", word)).replace(""", "\"") - return [word, 'Fill in the blank: "{}"'.format(chuck)] + return [word, 'Fill in the blank: "{}"'.format(chuck)] diff --git a/Code/irc/util/randomThings.py b/Code/irc/util/randomThings.py new file mode 100644 index 0000000..1104256 --- /dev/null +++ b/Code/irc/util/randomThings.py @@ -0,0 +1,34 @@ +#!/usr/bin/python3 +import json +import random +import requests + +def getRandom(query = "randomlists"): + query = query.lower().replace(' ', '-') + message = "" + request = requests.get("https://www.randomlists.com/data/{}.json".format(query)) + if request.status_code == 404: + request = requests.get("https://www.randomlists.com/data/random-{}.json".format(query)) + if request.status_code == 404: + message = "No results found. Try" + request = requests.get("https://www.randomlists.com/data/randomlists.json") + + jdata = json.loads(request.content) + items = list() + + if 'RandL' in jdata: + items = list(jdata['RandL']['items']) + elif 'data' in jdata: + items = list(jdata['data']) + + item = random.choice(items) + if 'name' in item: + message += " " + item['name'] + if 'detail' in item: + message += ": " + item['detail'] + if 'subtle' in item: + message += " (" + item['subtle'] + ")" + if message == "": + message = item + + return message.strip() diff --git a/Code/irc/util/tilde.py b/Code/irc/util/tilde.py index 81af28b..d65e442 100755 --- a/Code/irc/util/tilde.py +++ b/Code/irc/util/tilde.py @@ -2,6 +2,7 @@ # Import some necessary libraries. import random +import re import inflect import util.puzzle @@ -58,7 +59,13 @@ def get_negative(): "Not quite", "Not even close", "Not for you", - "I think not" + "I think not", + "Wait... uh maybe?", + "It could have been", + "It should have been", + "Whoops", + "SegFault: Insufficient Tildes", + "Wait, what did you guess?" ] ) @@ -83,6 +90,8 @@ def get_superlative(score): "worth twice their weight in gold", "the hero we need", "no ordinary townie", + "the bot whisperer", + "probably predicting rng", ] ) elif score > 2: @@ -95,13 +104,18 @@ def get_superlative(score): "radical", "intense", "pretty lucky", - "knows the territory", - "has what it takes", - "has mad skillz", + #"knows the territory", + #"has what it takes", + #"has mad skillz", "going the distance", "a hard worker", "my sunshine", "ready to rumble", + "better than sliced bread", + "main protagonist material", + "right as rain", + "a puzzle prophet", + "a counter-captcha expert", ] ) else: @@ -120,6 +134,13 @@ def get_superlative(score): "probably not a robot", "valuable to the team", "now trending", + "on your way up", + "credit to team", + "a net positive", + "groovy", + "competent", + "not wrong", + "on the right track", ] ) @@ -167,6 +188,7 @@ def get_bad_thing(): "actually answered the last question", "has their pants on backwards", "forgot their own name", + "got me really confused" ] ) @@ -264,6 +286,16 @@ def challenge(channel, user, time): challenges[user] = challenge[1:] return "{}: {}".format(user, challenge[0]) +def valid_answer(answer, guess): + guess = guess.lower(); + if callable(answer): + return answer(guess) + else: + # convert the guess and answer to just alphanumeric values. some + # "answers" acidentally have punctuation or other things in them + guess = re.sub(r'\W+', '', guess) + answer = re.sub(r'\w+', '', str(answer).lower()) + return (msg == answer or msg == p.number_to_words(answer)) def challenge_response(user, time, msg): global challenges @@ -271,9 +303,7 @@ def challenge_response(user, time, msg): response = "" if user in challenges: answer, bonus = challenges[user] - if (callable(answer) and answer(msg.lower())) or ( - msg.lower() == str(answer).lower() or msg == p.number_to_words(answer) - ): + if valid_answer(answer, msg): response = give_tilde(user, time, True, bonus) else: response = give_tilde(user, time, False, 0) diff --git a/Code/irc/util/tropes.py b/Code/irc/util/tropes.py new file mode 100644 index 0000000..e8daa18 --- /dev/null +++ b/Code/irc/util/tropes.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 +import requests +from bs4 import BeautifulSoup + +# These seem to get the same result each time we run them. I think TVTropes +# has some anti-scraping mechanism +def getTrope(): + url = "https://tvtropes.org" + html = BeautifulSoup(requests.get(url).content, "html.parser") + return url + html.find('a', { 'class': 'button-random-trope' })['href'] + +def getMedia(): + url = "https://tvtropes.org" + html = BeautifulSoup(requests.get(url).content, "html.parser") + return url + html.find('a', { 'class': 'button-random-media' })['href'] diff --git a/public_html/chatcloud/index.html b/public_html/chatcloud/index.html index 7e8b9fe..79366af 100644 --- a/public_html/chatcloud/index.html +++ b/public_html/chatcloud/index.html @@ -13,6 +13,8 @@