Skip to content

Commit 32748a4

Browse files
committed
Fix command documentation and reformat file
1 parent 3425729 commit 32748a4

1 file changed

Lines changed: 17 additions & 23 deletions

File tree

plugins/horoscope.py

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@
1616

1717

1818
@hook.command(autohelp=False)
19-
def horoscope(text, db, bot, notice, nick):
20-
"""<sign> - get your horoscope"""
19+
def horoscope(text, db, bot, nick, notice_doc):
20+
"""[sign] - get your horoscope"""
2121
signs = {
22-
'aries': '1',
23-
'taurus': '2',
24-
'gemini': '3',
25-
'cancer': '4',
26-
'leo': '5',
27-
'virgo': '6',
28-
'libra': '7',
29-
'scorpio': '8',
30-
'sagittarius': '9',
31-
'capricorn': '10',
32-
'aquarius': '11',
33-
'pisces': '12'
22+
'aries': '1',
23+
'taurus': '2',
24+
'gemini': '3',
25+
'cancer': '4',
26+
'leo': '5',
27+
'virgo': '6',
28+
'libra': '7',
29+
'scorpio': '8',
30+
'sagittarius': '9',
31+
'capricorn': '10',
32+
'aquarius': '11',
33+
'pisces': '12'
3434
}
3535

3636
headers = {'User-Agent': bot.user_agent}
@@ -43,15 +43,15 @@ def horoscope(text, db, bot, notice, nick):
4343
sign = text.strip().lower()
4444

4545
if not sign:
46-
sign = db.execute("select sign from horoscope where "
46+
sign = db.execute("SELECT sign FROM horoscope WHERE "
4747
"nick=lower(:nick)", {'nick': nick}).fetchone()
4848
if not sign:
49-
notice("horoscope <sign> -- Get your horoscope")
49+
notice_doc()
5050
return
5151
sign = sign[0].strip().lower()
5252

5353
params = {
54-
"sign": signs[sign]
54+
"sign": signs[sign]
5555
}
5656

5757
url = "http://www.horoscope.com/us/horoscopes/general/horoscope-general-daily-today.aspx"
@@ -65,12 +65,6 @@ def horoscope(text, db, bot, notice, nick):
6565
soup = BeautifulSoup(request.text)
6666

6767
horoscope_text = soup.find("div", class_="horoscope-content").find("p").text
68-
'''
69-
if not horoscope_text:
70-
return "Could not get the horoscope for {}. Hororscope text error".format(sign)
71-
else:
72-
horoscope_text = horoscope_text[0].text.strip()
73-
'''
7468
result = "\x02{}\x02 {}".format(text, horoscope_text)
7569

7670
if text and not dontsave:

0 commit comments

Comments
 (0)