Browse Source

Ported banterbot to pinhook framework and some other changes

master
Russell 3 years ago
parent
commit
bc102890b2
  1. 1
      .bash_aliases
  2. 2
      .bashrc
  3. 2
      .config/systemd/user/banterbot.service
  4. 609
      .tracery/aphorism
  5. 8
      .tracery/guid
  6. 29
      .tracery/mission
  7. 414
      Code/irc/banterbot.py
  8. 440
      Code/irc/banterbot_legacy.py
  9. 8
      Code/irc/banterbot_plugins/acronym.py
  10. 19
      Code/irc/banterbot_plugins/define.py
  11. 8
      Code/irc/banterbot_plugins/evil.py
  12. 8
      Code/irc/banterbot_plugins/fight.py
  13. 18
      Code/irc/banterbot_plugins/figlet.py
  14. 23
      Code/irc/banterbot_plugins/newbanter.py
  15. 7
      Code/irc/banterbot_plugins/notice.py
  16. 21
      Code/irc/banterbot_plugins/rainbow.py
  17. 21
      Code/irc/banterbot_plugins/rhymes.py
  18. 10
      Code/irc/banterbot_plugins/rollcall.py
  19. 10
      Code/irc/banterbot_plugins/score_banter.py
  20. 7
      Code/irc/banterbot_plugins/template.py
  21. 19
      Code/irc/banterbot_plugins/toilet.py
  22. 12
      Code/irc/banterbot_plugins/tumblr.py
  23. 8
      Code/irc/banterbot_plugins/water.py
  24. 8
      Code/irc/banterbot_plugins/welch.py
  25. 8
      Code/irc/banterbot_plugins/whosaid.py
  26. 18
      Code/irc/banterbot_plugins/wphilosophy.py
  27. 8
      Code/irc/banterbot_plugins/xkcd.py
  28. 55
      Code/irc/newBanter.py
  29. 16
      Code/irc/puzzle.py
  30. 16
      Code/irc/quote_puzzle.py
  31. 31
      Code/irc/tildebot.py
  32. 98
      Code/irc/tildescores.txt
  33. 59
      Code/irc/topicbot.py
  34. 3
      Code/irc/topicscores.txt
  35. 2
      Code/irc/util.py
  36. 17
      Code/irc/wikiphilosophy.py
  37. 38
      Code/python/chatcloud2.py
  38. 16
      Code/python/create_monthly_chatcloud.sh
  39. 41
      public_html/chatcloud/index.html

1
.bash_aliases

@ -18,3 +18,4 @@ alias pp='python -mjson.tool'
alias ttbp='~endorphant/bin/ttbp'
alias vuln='find /home/ \! -type l -perm -o=w ! -iwholename '*.git*' 2> /dev/null'
alias vulnc='vuln | sed "s/\/home\/\([^/]*\)\/.*/\1/g" | sort | uniq -c | sort -nr'
alias chat='mesg n; /usr/local/bin/chat'

2
.bashrc

@ -115,3 +115,5 @@ man() {
LESS_TERMCAP_us=$'\e[1;32m' \
man "$@"
}
PYTHONPATH=/home/krowbar/bin/python

2
.config/systemd/user/banterbot.service

@ -4,7 +4,7 @@ After=banterbot.service
[Service]
Type=simple
ExecStart=/home/krowbar/Code/irc/banterbot.py -s 127.0.0.1:6667 -n banterbot -c #tildetown #bots
ExecStart=/home/krowbar/Code/irc/banterbot.py -s 127.0.0.1 -p 6667 -n banterbot -c #tildetown #bots
WorkingDirectory=/home/krowbar/Code/irc/
Restart=always
RestartSec=5

609
.tracery/aphorism

@ -0,0 +1,609 @@
{
"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.ae# and #pronoun_possessive# #money# are #adverb# #verb#ed",
"#adjective.a# #noun#is the 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."
]
}

8
.tracery/guid

@ -0,0 +1,8 @@
{
"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"]
}

29
.tracery/mission

@ -0,0 +1,29 @@
{
"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"
]
}

414
Code/irc/banterbot.py

@ -1,32 +1,7 @@
#!/usr/bin/python3
# using python3 because of unicode and crap
# http://wiki.shellium.org/w/Writing_an_IRC_bot_in_Python
# Import some necessary libraries.
import argparse
import socket
import os
import sys
import fileinput
import random
import re
import subprocess
import textwrap
import time
import datetime
import inflect
from rhymesWith import getRhymes
from rhymesWith import rhymeZone
from defineWord import defWord
import welch
import evil
import tumblr
import xkcdApropos
import wikiphilosophy
import acronymFinder
import util
from whosaid import whoSaid
from pinhook.bot import Bot
parser = argparse.ArgumentParser()
@ -34,10 +9,19 @@ parser.add_argument(
"-s",
"--server",
dest="server",
default="127.0.0.1:6667",
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",
@ -65,370 +49,16 @@ parser.add_argument(
)
args = parser.parse_args()
p = inflect.engine()
def hello():
util.sendmsg(ircsoc, channel, "Hello!")
def score_banter(channel, user, messageText):
score = 5
with open("banterscores.txt", "r") as banterfile:
bantz = banterfile.readlines()
words = messageText.strip("\n").split(" ")
for word in words:
for bant in bantz:
bword = bant.strip("\n").split("|")
if re.sub("[^a-z0-9]+", "", word.lower()) == bword[0]:
score += int(bword[1])
score += messageText.count("!") * 2 # hype is banter
score -= messageText.count("!!!") * 6 # too much hype is not banter
score += messageText.count("#") * 3 # hashs are mad bantz
score -= messageText.count("##") * 6 # but too many is garbage
names = ["mate", "lad", "my best boy"]
compliment = [
"top-drawer",
"top-shelf",
"bangin'",
"legendary",
"smashing",
"incredible",
"impeccable",
"stunning",
]
msg = ""
if score > 100:
msg = "Truely {}, {}! That was some #banter! You earned a {} for that!".format(
random.choice(compliment).capitalize(), random.choice(names), score
)
elif score > 50:
msg = "{} #banter! You get a {} from me!".format(
random.choice(compliment).capitalize(), score
print(args)
bot = Bot(
channels = args.channels,
nickname = args.nick,
ops = [ args.owner ],
plugin_dir = "{}_plugins".format(args.nick),
server = args.server,
port = args.port
)
elif score > 10:
msg = "{} #banter. You get a {}".format(
random.choice(["acceptible", "reasonable", "passable"]).capitalize(), score
)
else:
msg = "That {} #banter, {}. I'll give you a {}. Maybe try again?".format(
random.choice(
["was hardly", "was barely", "wasn't", "won't pass for", "was awful"]
),
random.choice(["lad", "lah", "boy", ""]),
score,
)
util.sendmsg(ircsock, channel, msg)
def get_new_banter(channel, user):
with open("/usr/share/dict/words", "r") as dict:
words = list(filter(lambda word: re.search(r"^[^']*$", word), dict.readlines()))
if random.randint(0, 1): # look for *ant words
words = list(filter(lambda word: re.search(r"ant", word), words))
random.shuffle(words)
word = words[0].strip("\n")
start = word.find("ant")
if start == 0:
word = "b" + word
else:
if "aeiou".find(word[start]) > -1: # just append a 'b'
word = word[:start] + "b" + word[start:]
else: # replace the letter with 'b'
word = word[: start - 1] + "b" + word[start:]
else: # look for ban* words
words = list(filter(lambda word: re.search(r"ban", word), words))
random.shuffle(words)
word = words[0].strip("\n")
end = word.find("ban") + 3
if end == len(word):
word = word + "t"
else:
if "aeiou".find(word[end]) > -1: # just append 't'
word = word[:end] + "t" + word[end:]
else: # replace the letter with 'b'
word = word[:end] + "t" + word[end + 1 :]
util.sendmsg(
ircsock, channel, "{} : Here, why don't you try '{}'?".format(user, word)
)
def get_rhymes(channel, user, text):
word = ""
if len(text.split(" ")) > 1:
word = text.split(" ")[1]
else:
with open("/home/nossidge/poems/words_poetic.txt", "r") as words:
word = random.choice(words.readlines()).strip("\n")
rhymes = rhymeZone(word)
if len(rhymes) == 0:
util.sendmsg(
ircsock,
channel,
"{}: Couldn't find anything that rhymes with '{}' :(".format(user, word),
)
else:
util.sendmsg(
ircsock,
channel,
"{}: Here, these words rhyme with '{}': {}".format(
user, word, ", ".join(rhymes)
),
)
def define_word(channel, user, text):
word = ""
defs = []
if len(text.split(" ")) > 1:
word = text.split(" ")[1]
defs = defWord(word)
if len(defs) == 0:
util.sendmsg(
ircsock,
channel,
"{}: Couldn't find the definition of '{}' :(".format(user, word),
)
elif isinstance(defs, list):
for entry in defs:
util.sendmsg(
ircsock, channel, "{} : Define '{}' {}".format(user, word, entry[0:400])
)
else:
util.sendmsg(
ircsock, channel, "{} : Define '{}' {}".format(user, word, defs[0:400])
)
def make_rainbow(channel, user, text):
rbword = util.makeRainbow(text[9:])
util.sendmsg(ircsock, channel, rbword)
def get_welch(channel):
util.sendmsg(ircsock, channel, welch.get_thing()[0:400])
def get_evil(channel):
evilThing = evil.get_thing()
for line in [evilThing[i : i + 400] for i in range(0, len(evilThing), 400)]:
util.sendmsg(ircsock, channel, line)
def get_tumble(url, channel):
tumble = tumblr.tumble(url)
for line in [tumble[i : i + 400] for i in range(0, len(tumble), 400)]:
util.sendmsg(ircsock, channel, line)
def get_xkcd(channel, text):
links = xkcdApropos.xkcd(text[6:])
joined_links = ", ".join(links)
for line in [joined_links[i : i + 400] for i in range(0, len(joined_links), 400)]:
util.sendmsg(ircsock, channel, line)
def get_wphilosophy(channel, text):
util.sendmsg(ircsock, channel, "Ok, give me a minute while I look up '{}'".format(text))
steps = wikiphilosophy.get_philosophy_lower(text)
if not steps:
util.sendmsg(
ircsock, channel, "Couldn't find a wikipedia entry for {}".format(text)
)
else:
joined_steps = " > ".join(steps)
if steps[-1] == "Philosophy":
joined_steps += "!!!"
for line in [
joined_steps[i : i + 400] for i in range(0, len(joined_steps), 400)
]:
util.sendmsg(ircsock, channel, line)
def figlet(channel, text):
if not text:
util.sendmsg(ircsock, channel, "No text given. :(")
else:
lines = subprocess.Popen(
["figlet", "-w140"] + text.split(" "), shell=False, stdout=subprocess.PIPE
).stdout.read().decode("utf-8")
for line in lines.split("\n"):
util.sendmsg(ircsock, channel, line)
time.sleep(0.4) # to avoid channel throttle due to spamming
def toilet(channel, text):
if not text:
util.sendmsg(ircsock, channel, "No text given. :(")
else:
lines = subprocess.Popen(
["toilet", "-w140", "--irc"] + text.split(" "),
shell=False,
stdout=subprocess.PIPE,
).stdout.read().decode("utf-8")
for line in lines.split("\n"):
util.sendmsg(ircsock, channel, line)
time.sleep(0.4) # to avoid channel throttle due to spamming
def get_acronym(channel, text):
if not text:
util.sendmsg(ircsock, channel, "No text given :(")
else:
defs = acronymFinder.get_acros(text, True, True)
for d in defs[0:5]: # only the first five. they are already sorted by 'score'
util.sendmsg(ircsock, channel, d)
if len(defs) > 5:
util.sendmsg(ircsock, channel, defs[-1])
def get_whosaid(channel, text):
if not text:
util.sendmsg(ircsock, channel, " :No text given :(")
else:
result = whoSaid(text)
date = datetime.date.fromtimestamp(result["timecutoff"])
dateStr = date.strftime("%B %d")
if not result["data"]:
msg = "Nobody said '%s' since %s" % (text, dateStr)
else:
msg = "Since %s, %s said '%s' %d times" % (
dateStr,
result["data"][0][0],
text,
result["data"][0][1],
)
if len(result["data"]) > 1:
msg += " and %s said it %d times" % (
result["data"][1][0],
result["data"][1][1],
)
util.sendmsg(ircsock, channel, msg)
def get_notice(user, channel):
util.notice(ircsock, user, channel, "Notice me senpai!")
def get_water(user, channel, msg, botnick):
if msg.find(botnick) == 0:
util.sendmsg(ircsock, channel, "Fight me, {}!".format(user))
def mug_off(channel):
util.sendmsg(ircsock, channel, "u want some of this, m8?")
def rollcall(channel):
text = """
U wot m8? I score all the top drawer #banter and #bantz on this channel! / Find new top-shelf banter with !newbanter, !rhymes, and !define.
Look up things with !acronym and !whosaid / Make your chatter #legend with !rainbow, !toilet, and !figlet.
Find interesting things with !xkcd and !wiki-philosophy / Get jokes with !welch !evil !kjp and !help
"""
for line in textwrap.dedent(text).split("\n"):
if line == "":
continue
util.sendmsg(ircsock, channel, line)
def listen(botnick):
while 1: # loop forever
ircmsg = ircsock.recv(2048).decode('utf-8')
for msg in ircmsg.split("\n"):
msg = msg.strip("\n\r")
if msg[:4] == "PING":
util.ping(ircsock, msg)
continue
formatted = util.format_message(msg)
if "" == formatted:
continue
print(formatted)
_time, user, _command, channel, messageText = formatted.split("\t")
if messageText.find("#banter") != -1 or messageText.find("#bantz") != -1:
score_banter(channel, user, messageText)
if messageText.startswith("!newbanter"):
get_new_banter(channel, user)
if messageText.startswith("!rhymes"):
get_rhymes(channel, user, messageText)
if messageText.startswith("!define"):
define_word(channel, user, messageText)
if messageText.startswith("!rainbow"):
make_rainbow(channel, user, messageText)
if messageText.startswith("!welch"):
get_welch(channel)
if messageText.startswith("!evil"):
get_evil(channel)
if messageText.startswith("!kjp"):
get_tumble("http://kingjamesprogramming.tumblr.com", channel)
if messageText.startswith("!help"):
get_tumble("http://thedoomthatcametopuppet.tumblr.com", channel)
if messageText.startswith("!xkcd"):
get_xkcd(channel, messageText)
if messageText.startswith("!wiki-philosophy"):
get_wphilosophy(channel, messageText[17:])
if messageText.startswith("!figlet"):
figlet(channel, messageText[8:])
if messageText.startswith("!toilet"):
toilet(channel, messageText[8:])
if messageText.startswith("!acronym"):
get_acronym(channel, messageText[9:])
if messageText.startswith("!whosaid"):
get_whosaid(channel, messageText[9:])
if messageText.startswith("!notice"):
get_notice(user, channel)
if messageText.startswith("!water"):
get_water(user, channel, messageText[7:], botnick)
if messageText.startswith("!rollcall"):
rollcall(channel)
if messageText.startswith(botnick + ":"):
mug_off(channel)
if messageText.startswith("!join") and user == args.owner:
util.joinchan(ircsock, messageText[6:])
if messageText.startswith("!part") and user == args.owner:
util.part(ircsock, messageText[6:])
if messageText.startswith("!quit") and user == args.owner:
util.quit(ircsock, "Later chumps!")
return
sys.stdout.flush()
time.sleep(1)
# ROOT: i commented this out until it stops pegging the CPU.
# ~krowbar: this has the same logic loop as tildebot but for whatever reason
# it is banterbot that gets booted from IRC then rage-thrashes the machine
ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
util.connect(ircsock, args)
listen(args.nick)
if __name__ == "__main__":
bot.start()

440
Code/irc/banterbot_legacy.py

@ -0,0 +1,440 @@
#!/usr/bin/python3
# using python3 because of unicode and crap
# http://wiki.shellium.org/w/Writing_an_IRC_bot_in_Python
# Import some necessary libraries.
import argparse
import socket
import os
import sys
import fileinput
import random
import re
import subprocess
import textwrap
import time
import datetime
import inflect
from rhymesWith import getRhymes
from rhymesWith import rhymeZone
from defineWord import defWord
import welch
import evil
import tumblr
import xkcdApropos
import wikiphilosophy
import acronymFinder
import util
from whosaid import whoSaid
parser = argparse.ArgumentParser()
parser.add_argument(
"-s",
"--server",
dest="server",
default="127.0.0.1:6667",
help="the server to connect to",
metavar="SERVER",
)
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_legacy",
help="the nick to use",
metavar="NICK",
)
parser.add_argument(
"-o",
"--owner",
dest="owner",
default="krowbar",
help="the owner of this bot",
metavar="OWNER",
)
args = parser.parse_args()
p = inflect.engine()
def hello():
util.sendmsg(ircsoc, channel, "Hello!")
def score_banter(channel, user, messageText):
score = 5
with open("banterscores.txt", "r") as banterfile:
bantz = banterfile.readlines()
words = messageText.strip("\n").split(" ")
for word in words:
for bant in bantz:
bword = bant.strip("\n").split("|")
if re.sub("[^a-z0-9]+", "", word.lower()) == bword[0]:
score += int(bword[1])
score += messageText.count("!") * 2 # hype is banter
score -= messageText.count("!!!") * 6 # too much hype is not banter
score += messageText.count("#") * 3 # hashs are mad bantz
score -= messageText.count("##") * 6 # but too many is garbage
names = ["mate", "lad", "my best boy"]
compliment = [
"top-drawer",
"top-shelf",
"bangin'",
"legendary",
"smashing",
"incredible",
"impeccable",
"stunning",
]
msg = ""
if score > 100:
msg = "Truely {}, {}! That was some #banter! You earned a {} for that!".format(
random.choice(compliment).capitalize(), random.choice(names), score
)
elif score > 50:
msg = "{} #banter! You get a {} from me!".format(
random.choice(compliment).capitalize(), score
)
elif score > 10:
msg = "{} #banter. You get a {}".format(
random.choice(["acceptible", "reasonable", "passable"]).capitalize(), score
)
else:
msg = "That {} #banter, {}. I'll give you a {}. Maybe try again?".format(
random.choice(
["was hardly", "was barely", "wasn't", "won't pass for", "was awful"]
),
random.choice(["lad", "lah", "boy", ""]),
score,
)
util.sendmsg(ircsock, channel, msg)
def get_new_banter(channel, user):
with open("/usr/share/dict/words", "r") as dict:
words = list(filter(lambda word: re.search(r"^[^']*$", word), dict.readlines()))
if random.randint(0, 1): # look for *ant words
words = list(filter(lambda word: re.search(r"ant", word), words))
random.shuffle(words)
word = words[0].strip("\n")
start = word.find("ant")
if start == 0:
word = "b" + word
else:
if "aeiou".find(word[start]) > -1: # just append a 'b'
word = word[:start] + "b" + word[start:]
else: # replace the letter with 'b'
word = word[: start - 1] + "b" + word[start:]
else: # look for ban* words
words = list(filter(lambda word: re.search(r"ban", word), words))
random.shuffle(words)
word = words[0].strip("\n")
end = word.find("ban") + 3
if end == len(word):
word = word + "t"
else:
if "aeiou".find(word[end]) > -1: # just append 't'
word = word[:end] + "t" + word[end:]
else: # replace the letter with 'b'
word = word[:end] + "t" + word[end + 1 :]
util.sendmsg(
ircsock, channel, "{} : Here, why don't you try '{}'?".format(user, word)
)
def get_rhymes(channel, user, text):
word = ""
if len(text.split(" ")) > 1:
word = text.split(" ")[1]
else:
with open("/home/nossidge/poems/words_poetic.txt", "r") as words:
word = random.choice(words.readlines()).strip("\n")
rhymes = rhymeZone(word)
if len(rhymes) == 0:
util.sendmsg(
ircsock,
channel,
"{}: Couldn't find anything that rhymes with '{}' :(".format(user, word),
)
else:
util.sendmsg(
ircsock,
channel,
"{}: Here, these words rhyme with '{}': {}".format(
user, word, ", ".join(rhymes)
),
)
def define_word(channel, user, text):
word = ""
defs = []
if len(text.split(" ")) > 1:
word = text.split(" ")[1]
defs = defWord(word)
if len(defs) == 0:
util.sendmsg(
ircsock,
channel,
"{}: Couldn't find the definition of '{}' :(".format(user, word),
)
elif isinstance(defs, list):
for entry in defs:
util.sendmsg(
ircsock, channel, "{} : Define '{}' {}".format(user, word, entry[0:400])
)
else:
util.sendmsg(
ircsock, channel, "{} : Define '{}' {}".format(user, word, defs[0:400])
)
def make_rainbow(channel, user, text):
rbword = util.makeRainbow(text[9:])
util.sendmsg(ircsock, channel, rbword)
def get_welch(channel):
util.sendmsg(ircsock, channel, welch.get_thing()[0:400])
def get_evil(channel):
evilThing = evil.get_thing()
for line in [evilThing[i : i + 400] for i in range(0, len(evilThing), 400)]:
util.sendmsg(ircsock, channel, line)
def get_tumble(url, channel):
tumble = tumblr.tumble(url)
for line in [tumble[i : i + 400] for i in range(0, len(tumble), 400)]:
util.sendmsg(ircsock, channel, line)
def get_xkcd(channel, text):
links = xkcdApropos.xkcd(text[6:])
joined_links = ", ".join(links)
for line in [joined_links[i : i + 400] for i in range(0, len(joined_links), 400)]:
util.sendmsg(ircsock, channel, line)
def get_wphilosophy(channel, text):
util.sendmsg(ircsock, channel, "Ok, give me a minute while I look up '{}'".format(text))
steps = wikiphilosophy.get_philosophy_lower(text)
if not steps:
util.sendmsg(
ircsock, channel, "Couldn't find a wikipedia entry for {}".format(text)
)
else:
joined_steps = " > ".join(steps)
if steps[-1] == "Philosophy":
joined_steps += "!!!"
for line in [
joined_steps[i : i + 400] for i in range(0, len(joined_steps), 400)
]:
util.sendmsg(ircsock, channel, line)
def figlet(channel, text):
if not text:
util.sendmsg(ircsock, channel, "No text given. :(")
else:
lines = subprocess.Popen(
["figlet", "-w140"] + text.split(" "), shell=False, stdout=subprocess.PIPE
).stdout.read().decode("utf-8")
for line in lines.split("\n"):
util.sendmsg(ircsock, channel, line)
time.sleep(0.4) # to avoid channel throttle due to spamming
def toilet(channel, text):
if not text:
util.sendmsg(ircsock, channel, "No text given. :(")
else:
lines = subprocess.Popen(
["toilet", "-w140", "-F", "crop", "--irc"] + text.split(" "),
shell=False,
stdout=subprocess.PIPE,
).stdout.read().decode("utf-8")
for line in lines.split("\n"):
util.sendmsg(ircsock, channel, line)
time.sleep(0.4) # to avoid channel throttle due to spamming
def get_acronym(channel, text):
if not text:
util.sendmsg(ircsock, channel, "No text given :(")
else:
defs = acronymFinder.get_acros(text, True, True)
for d in defs[0:5]: # only the first five. they are already sorted by 'score'
util.sendmsg(ircsock, channel, d)
if len(defs) > 5:
util.sendmsg(ircsock, channel, defs[-1])
def get_whosaid(channel, text):
if not text:
util.sendmsg(ircsock, channel, " :No text given :(")
else:
result = whoSaid(text)
date = datetime.date.fromtimestamp(result["timecutoff"])
dateStr = date.strftime("%B %d")
if not result["data"]:
msg = "Nobody said '%s' since %s" % (text, dateStr)
else:
msg = "Since %s, %s said '%s' %d times" % (
dateStr,
result["data"][0][0],
text,
result["data"][0][1],
)
if len(result["data"]) > 1:
msg += " and %s said it %d times" % (
result["data"][1][0],
result["data"][1][1],
)
util.sendmsg(ircsock, channel, msg)
def get_notice(user, channel):
util.notice(ircsock, user, channel, "Notice me senpai!")
def get_water(user, channel, msg, botnick):
if msg.find(botnick) == 0:
util.sendmsg(ircsock, channel, "Fight me, {}!".format(user))
def mug_off(channel):
util.sendmsg(ircsock, channel, "u want some of this, m8?")
def rollcall(channel):
text = """
U wot m8? I score all the top drawer #banter and #bantz on this channel! / Find new top-shelf banter with !newbanter [mungeWord [dictionary]], !rhymes, and !define.
Look up things with !acronym and !whosaid / Make your chatter #legend with !rainbow, !toilet, and !figlet.
Find interesting things with !xkcd and !wiki-philosophy / Get jokes with !welch !evil !kjp and !help
"""
for line in textwrap.dedent(text).split("\n"):
if line == "":
continue
util.sendmsg(ircsock, channel, line)
def listen(botnick):
while 1: # loop forever
ircmsg = ircsock.recv(2048).decode('utf-8')
for msg in ircmsg.split("\n"):
msg = msg.strip("\n\r")
if msg[:4] == "PING":
util.ping(ircsock, msg)
continue
formatted = util.format_message(msg)
if "" == formatted:
time.sleep(1)
continue
# print(formatted)
_time, user, _command, channel, messageText = formatted.split("\t")
if messageText.find("#banter") != -1 or messageText.find("#bantz") != -1:
score_banter(channel, user, messageText)
if messageText.startswith("!newbanter"):
get_new_banter(channel, user, messageText)
if messageText.startswith("!rhymes"):
get_rhymes(channel, user, messageText)
if messageText.startswith("!define"):
define_word(channel, user, messageText)
if messageText.startswith("!rainbow"):
make_rainbow(channel, user, messageText)
if messageText.startswith("!welch"):
get_welch(channel)
if messageText.startswith("!evil"):
get_evil(channel)
if messageText.startswith("!kjp"):
get_tumble("http://kingjamesprogramming.tumblr.com", channel)
if messageText.startswith("!help"):
get_tumble("http://thedoomthatcametopuppet.tumblr.com", channel)
if messageText.startswith("!xkcd"):
get_xkcd(channel, messageText)
if messageText.startswith("!wiki-philosophy"):
get_wphilosophy(channel, messageText[17:])
if messageText.startswith("!figlet"):
figlet(channel, messageText[8:])
if messageText.startswith("!toilet"):
toilet(channel, messageText[8:])
if messageText.startswith("!acronym"):
get_acronym(channel, messageText[9:])
if messageText.startswith("!whosaid"):
get_whosaid(channel, messageText[9:])
if messageText.startswith("!notice"):
get_notice(user, channel)
if messageText.startswith("!water"):
get_water(user, channel, messageText[7:], botnick)
if messageText.startswith("!rollcall"):
rollcall(channel)
if messageText.startswith(botnick + ":"):
mug_off(channel)
if messageText.startswith("!join") and user == args.owner:
util.joinchan(ircsock, messageText[6:])
if messageText.startswith("!part") and user == args.owner:
util.part(ircsock, messageText[6:])
if messageText.startswith("!quit") and user == args.owner:
util.quit(ircsock, "Later chumps!")
return
sys.stdout.flush()
time.sleep(1)
if __name__ == "__main__":
# ROOT: i commented this out until it stops pegging the CPU.
# ~krowbar: this has the same logic loop as tildebot but for whatever reason
# it is banterbot that gets booted from IRC then rage-thrashes the machine
ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
util.connect(ircsock, args)
listen(args.nick)
else:
# create a fake socket that we'll use to just write to the screen
import mock
ircsock = mock.Mock()
# print("!! ircsock was not initialized! most methods will not work !!")

8
Code/irc/banterbot_plugins/acronym.py

@ -0,0 +1,8 @@
#!/usr/bin/python3
import pinhook.plugin
from util import acronymFinder
@pinhook.plugin.register('!acronym')
def acronym_plugin(msg):
return pinhook.plugin.message(acronymFinder.get_acros(msg.arg, True, True))

19
Code/irc/banterbot_plugins/define.py

@ -0,0 +1,19 @@
#!/usr/bin/python3
import pinhook.plugin
from util import defineWord
@pinhook.plugin.register('!define')
def define_plugin(msg):
if not msg.arg:
return pinhook.plugin.message("{}: No word given".format(msg.nick))
word = msg.arg.split()[0]
defs = defineWord.defWord(word)
if not defs:
return pinhook.plugin.message("{}: Couldn't find the definition of '{}' :(".format(msg.nick, word))
elif isinstance(defs, list):
return pinhook.plugin.message("\n".join(["{} : Define '{}' {}".format(msg.nick, word, entry) for entry in defs]))
else:
return pinhook.plugin.message("{} : Define '{}' {}".format(msg.nick, word, defs))

8
Code/irc/banterbot_plugins/evil.py

@ -0,0 +1,8 @@
#!/usr/bin/python3
import pinhook.plugin
from util import evil
@pinhook.plugin.register('!evil')
def evil_plugin(msg):
return pinhook.plugin.message(evil.get_thing())

8
Code/irc/banterbot_plugins/fight.py

@ -0,0 +1,8 @@