Skip to content

Commit

Permalink
Merge pull request #124 from paulosgf/plugLints
Browse files Browse the repository at this point in the history
Fix #3
- several plugin lints
  • Loading branch information
paulosgf authored Jul 21, 2022
2 parents f0d6948 + fec3a79 commit 56fb764
Show file tree
Hide file tree
Showing 34 changed files with 169 additions and 127 deletions.
2 changes: 1 addition & 1 deletion src/honeybot/plugins/downloaded/age/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
COMMANDS = '''
>>> .age <<day>> <<month>> <<year>>
returns age in yr/mo/day format.
'''
'''
8 changes: 4 additions & 4 deletions src/honeybot/plugins/downloaded/age/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def run(self, incoming, methods, info, bot_info):
print(len(msgs))
if info["command"] == "PRIVMSG" and msgs[0] == ".age":
if (
len(msgs) == 4
and len(msgs[1]) < 3
and len(msgs[2]) < 3
and len(msgs[3]) == 4
len(msgs) == 4 and
len(msgs[1]) < 3 and
len(msgs[2]) < 3 and
len(msgs[3]) == 4
):
day = int(msgs[1])
mo = int(msgs[2])
Expand Down
2 changes: 1 addition & 1 deletion src/honeybot/plugins/downloaded/bitcoin/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
returns current value of bitcoin
'''

WEBSITE = 'https://Macr0Nerd.github.io'
WEBSITE = 'https://Macr0Nerd.github.io'
4 changes: 2 additions & 2 deletions src/honeybot/plugins/downloaded/book_of_day/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
'UMD'
]

ABOUT = '''
ABOUT = '''book_of_day
Using bookoftheday.org, get the title and link of the book of the day
'''

COMMANDS = '''
>>> .bookoftheday
https://bookoftheday.org/fleishman-is-in-trouble-taffy-brodesser-akner/
'''
'''
2 changes: 1 addition & 1 deletion src/honeybot/plugins/downloaded/caesar_cipher/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
returns the encrypted version of message
'''

WEBSITE = ''
WEBSITE = ''
2 changes: 1 addition & 1 deletion src/honeybot/plugins/downloaded/calc/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
returns evaluated expression
'''

WEBSITE = ''
WEBSITE = ''
5 changes: 3 additions & 2 deletions src/honeybot/plugins/downloaded/channeljoin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ def run(self, incoming, methods, info, bot_info):
else:
methods["send"](
info["address"],
"only bot owners can execute this function, "
+ "make sure your IRC nickname is in the settings/OWNERS.conf file",
"only bot owners can execute this function, " +
"make sure your IRC nickname is in the " +
"settings/OWNERS.conf file",
)

except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions src/honeybot/plugins/downloaded/cointoss/main.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# development of cointoss plugin for honeybot
"""
[Toss.py]
A plugin to toss a coin
A plugin to toss a coin
[Author]
Shriram Bhat
[About]
Responds to .cointoss, Returns head or tail at random
Responds to .cointoss, Returns head or tail at random
[commands]
>>> .cointoss
Expand Down
5 changes: 3 additions & 2 deletions src/honeybot/plugins/downloaded/conv_sniff/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
Abdur-Rahmaan Janhangeer, pythonmembers.club
[About]
senses conversation topic with sensitivity set by user, also supports
senses conversation topic with sensitivity set by user, also supports
word-specific sensing
"""

import random


class Plugin:
"""
checkin
checkin
L checks in list
S checks in string
"""
Expand Down
19 changes: 10 additions & 9 deletions src/honeybot/plugins/downloaded/converter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self):
def help(self, methods, info):
methods["send"](info["address"], "showing supported currencies")
currency_lists = [
Plugin.currencies[5 * i : 5 * i + 5]
Plugin.currencies[5 * i: 5 * i + 5]
for i in range(0, math.ceil(len(Plugin.currencies) / 5))
]
for currency_list in currency_lists:
Expand All @@ -99,19 +99,20 @@ def is_number(char):
base_cur = base_cur.upper()
target_cur = target_cur.upper()
if base_cur not in Plugin.currencies or target_cur not in Plugin.currencies:
return "one of the currencies is invalid. enter .converter help to see supported currencies"
return "one of the currencies is invalid. " \
"enter .converter help to see supported currencies"
elif not (is_number(amount)):
return "invalid amount entered, it must be a number. default is 1"
else:
base_url = "https://www.x-rates.com/calculator/?"
url = (
base_url
+ "from="
+ base_cur
+ "&to="
+ target_cur
+ "&amount="
+ str(amount)
base_url +
"from=" +
base_cur +
"&to=" +
target_cur +
"&amount=" +
str(amount)
)
page = requests.get(url)
soup = BeautifulSoup(page.text, "html.parser")
Expand Down
7 changes: 5 additions & 2 deletions src/honeybot/plugins/downloaded/diary/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ def record(self, time, text):
return True

def get_record(self, date):
"""check if there is a diary entry for a certain date and return it if there is """
"""
check if there is a diary entry for a certain date and return it if there is
"""
date = Plugin.today_yesterday(self, date)
path = "diary/" + date
if not os.path.exists(path):
Expand All @@ -88,7 +90,8 @@ def delete(self, time):
""" check if entry exists and if it does delete it """
path = Plugin.get_path(self, time)
if not os.path.exists(path):
return "There is no diary entry for that date. Check the date is entered correctly!"
return "There is no diary entry for that date. " \
"Check the date is entered correctly!"
else:
os.remove(path)
return "Entry deleted successfully!"
Expand Down
26 changes: 13 additions & 13 deletions src/honeybot/plugins/downloaded/hangman/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def hangman(self, command, word):
if command.lower() == "start":
self.class_hangman = Hangman()
msg = (
"Welcome to hangman! "
+ "You may use command 'start' to start new game "
+ "or 'guess ---' with a word or letter to play."
+ self.class_hangman.display_screen()
"Welcome to hangman! " +
"You may use command 'start' to start new game " +
"or 'guess ---' with a word or letter to play." +
self.class_hangman.display_screen()
)
elif command.lower() == "guess":
if len(word.strip()) > 1:
Expand Down Expand Up @@ -197,7 +197,7 @@ def guess_word(self, wordGuess):
else:
self.display_message = "'{0}' was incorrect. ".format(
wordGuess
) + "You have {1} guesses remaining.".format(wordGuess, self.guessCount)
) + "You have {0} guesses remaining.".format(self.guessCount)

# check_win determines if the user has guessed the entire word after each
# guess. If the user hasn't won, they lost one of their guesses.
Expand All @@ -208,11 +208,11 @@ def check_win(self):
if letter == "-":
win = False

if win == True:
if win is True:
self.display = "'{0}' is correct. You win!".format(self.gameWord)
self.display_message = (
" You had {0} guesses remaining.".format(self.guessCount)
+ "\nUse 'start' command to try again."
" You had {0} guesses remaining.".format(self.guessCount) +
"\nUse 'start' command to try again."
)
self.endGame = True
self.endMessage = self.display + self.display_message
Expand All @@ -226,9 +226,9 @@ def decrement_guesses(self):
self.guessCount -= 1
if self.guessCount == 0:
self.endMessage = (
"You have no more guesses.\n"
+ "The correct word was '{0}'.\n".format(self.gameWord)
+ "You lose. Use start command to try again"
"You have no more guesses.\n" +
"The correct word was '{0}'.\n".format(self.gameWord) +
"You lose. Use start command to try again"
)
self.endGame = True
else:
Expand All @@ -240,7 +240,7 @@ def decrement_guesses(self):
# state.

def display_screen(self):
if self.endGame == False:
if self.endGame is False:
return self.display + self.display_message
else:
return self.endMessage
Expand All @@ -255,4 +255,4 @@ def test_them(plugin, msg):
methods = {"send": send}
msg = msg
info = {"args": [None, msg], "command": "PRIVMSG", "address": "That place"}
plug.run("", methods, info)
plugin.run("", methods, info)
6 changes: 4 additions & 2 deletions src/honeybot/plugins/downloaded/help/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Show link with all the functionalities of the bot.
[Commands]
>>> .help
>>> .help
returns link of plugins informations
"""

Expand All @@ -23,7 +23,9 @@ def run(self, incoming, methods, info, bot_info):

try:
if info["command"] == "PRIVMSG" and info["args"][1] == ".help":
message = "Page with all functionalities and commands: https://github.com/Abdur-rahmaanJ/honeybot/blob/master/honeybot/plugins_info.md"
message = "Page with all functionalities and commands: " \
"https://github.com/Abdur-rahmaanJ/" \
"honeybot/blob/master/honeybot/plugins_info.md"
methods["send"](info["address"], message)
except Exception as e:
print("woops plug", e)
6 changes: 4 additions & 2 deletions src/honeybot/plugins/downloaded/horoscope/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ def horoscope(starsign):
if starsign not in signs:
message = "That is not a valid star sign, check for typos"
else:
basic_url = "https://www.horoscope.com/us/horoscopes/general/horoscope-general-daily-today.aspx?sign="
basic_url = "https://www.horoscope.com/us/horoscopes/general" \
"/horoscope-general-daily-today.aspx?sign="
url = basic_url + signs[starsign] # creates the url
content = requests.get(url) # gets the horoscope website
doc = BeautifulSoup(content.text, "html.parser") # parses website
message = doc.find_all("p")[
0
].text # the first p element of the website is the horoscope and we only want its text
].text # the first p element of the website
# is the horoscope and we only want its text
return message

def run(self, incoming, methods, info, bot_info):
Expand Down
33 changes: 20 additions & 13 deletions src/honeybot/plugins/downloaded/joke/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ def joke(self):
"I tried to take a bite out of the fog, but I mist.",
"What did the bodybuilder say when he ran out of protein powder? No whey.",
"What do you call a fake noodle? An Impasta.",
"Did you hear about the restaurant on the moon? It had great food but no \
atmosphere.",
"Why do the put fences around grave yards? Because people are dying to get in.",
"Did you hear about the restaurant on the moon?" +
" It had great food but no atmosphere.",
"Why do the put fences around grave yards?" +
" Because people are dying to get in.",
"How do you organize a party on Mars? You planet.",
"Why do crabs never give to charity? Because they are shellfish.",
"What is the difference between an African and Indian Elephant? About 5000 miles.",
"What is the difference between an African and Indian Elephant?" +
" About 5000 miles.",
"I don't like to play soccer for money. I play it just for kicks.",
"How many apples grow on a tree? All of them!",
"Did you hear the rumor about the butter? Well, I'm not going to spread it...",
"Did you hear the rumor about the butter?" +
" Well, I'm not going to spread it...",
"How does a penguin build his home? Igloos it together!",
"How to make a tissue dance? Put a little boogie in it!",
"If you saw a robbery at the Apple store, would you be an iWitness?",
Expand All @@ -59,18 +62,22 @@ def joke(self):
'I caught my wife yelling at the TV saying, "Don\'t go into the church you idiot!", \
She was watching our wedding video again.',
"When a woman is giving birth, she is literally kidding.",
"My wife yelled at me agai for having no sense of direction. So I packed up my stuff and right.",
'My son asked, "Can I have a book mark?" and I burst into tears. 11 years old and he still doesn\'t \
know my name in Brian.',
"If a child refuses to sleep during nap time, are they guilty of resisting a rest?",
"My wife yelled at me agai for having no sense of direction." +
" So I packed up my stuff and right.",
'My son asked, "Can I have a book mark?" and I burst into tears.' +
' 11 years old and he still doesn\'t know my name in Brian.',
"If a child refuses to sleep during nap time," +
" are they guilty of resisting a rest?",
"Geology rocks, but Geography is where it's at.",
"Scientists were starting to get bored watching the Earth turn, and so after 24 hours, they \
called it a day.",
"Scientists were starting to get bored watching the Earth turn," +
" and so after 24 hours, they called it a day.",
"My wife yelled at me an said, \"You haven't listened to anything I've said!\", which \
I thought was an interesting way to start a conversation.",
"I’d tell you a Fibonacci joke, but’s it’s probably as bad as the last two you’ve heard combined.",
"I’d tell you a Fibonacci joke, but’s it’s probably as bad" +
" as the last two you’ve heard combined.",
"What did the pirate say on his 80th birthday? AYE MATEY.",
"It's hard to explain puns to kleptomaniacs because they always take things literally.",
"It's hard to explain puns to kleptomaniacs" +
" because they always take things literally.",
]

return "{}".format(random.choice(jokes))
Expand Down
6 changes: 4 additions & 2 deletions src/honeybot/plugins/downloaded/mail/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
'''

COMMANDS = '''
.mail <To email address> .body <Text for the body of your email> .subject <Text of subject for email>
EX:// ".mail test@email.com .body testing body for honeybot email .subject testing subject"
.mail <To email address> .body <Text for the body of your email>
.subject <Text of subject for email>
EX:// ".mail test@email.com .body testing body for honeybot email
.subject testing subject"
'''

WEBSITE = ''
13 changes: 8 additions & 5 deletions src/honeybot/plugins/downloaded/mail/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
See that document for more information.
[Commands]
.mail <To email address> .body <Text for the body of your email> .subject <Text of subject for email>
EX:// ".mail test@email.com .body testing body for honeybot email .subject testing subject"
.mail <To email address> .body <Text for the body of your email>
.subject <Text of subject for email>
EX:// ".mail test@email.com .body testing body for honeybot email
.subject testing subject"
"""
import smtplib
import string
from email.mime.text import MIMEText
import configparser

Expand Down Expand Up @@ -113,7 +114,8 @@ def run(self, incoming, methods, info, bot_info):
) # fill the BODY string using the body function to extraxt the text
SUBJECT = Plugin.subject(
SUBJECT_INDEX, MAX_INDEX, msgs
) # fill the SUBJECT string using the subject function to extract the text
) # fill the SUBJECT string using the
# subject function to extract the text

MSG = MIMEText(
text + BODY, "html"
Expand All @@ -123,7 +125,8 @@ def run(self, incoming, methods, info, bot_info):
MSG["To"] = TO # Fills the TO field with the TO string
Plugin.__email(
HOST, PORT, USER, PASS, TO, MSG
) # Passes paramters needed to __email to be able to start up connection to SMTP server and send message
) # Passes paramters needed to __email to be able to
# start up connection to SMTP server and send message

except Exception as e:
print("\n*error*\nwoops plugin", __file__, e, "\n")
3 changes: 2 additions & 1 deletion src/honeybot/plugins/downloaded/maths/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def run(self, incoming, methods, info, bot_info):
if int(msgs[1]) >= int(msgs[2]):
methods["send"](
info["address"],
".rand requires two integers that are not equal and the first must be biggest",
".rand requires two integers that are not "
"equal and the first must be biggest",
)
else:
rand = random.randint(int(msgs[1]), int(msgs[2]))
Expand Down
6 changes: 3 additions & 3 deletions src/honeybot/plugins/downloaded/memo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def run(self, incoming, methods, info, bot_info):
if info["command"] == "PRIVMSG" and msgs[0] == ".memo" and msgs[1] == "rem":
methods["mem_rem"]("global", "VALUES", msgs[2])
if (
info["command"] == "PRIVMSG"
and msgs[0] == ".memo"
and msgs[1] == "fetch"
info["command"] == "PRIVMSG" and
msgs[0] == ".memo" and
msgs[1] == "fetch"
):
try:
val = methods["mem_fetch"]("global", "VALUES", msgs[2])
Expand Down
Loading

0 comments on commit 56fb764

Please sign in to comment.