Merge branch 'develop' of https://github.com/ClouDev/CloudBot into develop
This commit is contained in:
commit
f82041fc87
5 changed files with 17 additions and 17 deletions
|
@ -19,10 +19,10 @@ def define(inp):
|
|||
'//div[@class="example"]')
|
||||
|
||||
if not definition:
|
||||
return 'No results for ' + inp + ' :('
|
||||
return u'No results for {} :('.format(inp)
|
||||
|
||||
def format_output(show_examples):
|
||||
result = '{}: '.format(h.xpath('//dt[@class="title-word"]/a/text()')[0])
|
||||
result = u'{}: '.format(h.xpath('//dt[@class="title-word"]/a/text()')[0])
|
||||
|
||||
correction = h.xpath('//span[@class="correct-word"]/text()')
|
||||
if correction:
|
||||
|
@ -77,7 +77,7 @@ def etymology(inp):
|
|||
etym = h.xpath('//dl')
|
||||
|
||||
if not etym:
|
||||
return 'No etymology found for {} :('.format(inp)
|
||||
return u'No etymology found for {} :('.format(inp)
|
||||
|
||||
etym = etym[0].text_content()
|
||||
|
||||
|
|
|
@ -51,4 +51,4 @@ def geoip(inp):
|
|||
data["cc"] = record["country_code"] or "N/A"
|
||||
data["country"] = record["country_name"] or "Unknown"
|
||||
data["city"] = record["city"] or "Unknown"
|
||||
return "\x02Country:\x02 {country} ({cc}), \x02City:\x02 {city}{region}".format(**data)
|
||||
return u"\x02Country:\x02 {country} ({cc}), \x02City:\x02 {city}{region}".format(**data)
|
||||
|
|
|
@ -36,10 +36,10 @@ def lastfm(inp, nick='', db=None, bot=None, notice=None):
|
|||
api_key=api_key, user=user, limit=1)
|
||||
|
||||
if 'error' in response:
|
||||
return "Error: {}.".format(response["message"])
|
||||
return u"Error: {}.".format(response["message"])
|
||||
|
||||
if not "track" in response["recenttracks"] or len(response["recenttracks"]["track"]) == 0:
|
||||
return 'No recent tracks for user "{}" found.'.format(user)
|
||||
return u'No recent tracks for user "{}" found.'.format(user)
|
||||
|
||||
tracks = response["recenttracks"]["track"]
|
||||
|
||||
|
@ -66,11 +66,11 @@ def lastfm(inp, nick='', db=None, bot=None, notice=None):
|
|||
album = track["album"]["#text"]
|
||||
artist = track["artist"]["#text"]
|
||||
|
||||
out = '{} {} "{}"'.format(user, status, title)
|
||||
out = u'{} {} "{}"'.format(user, status, title)
|
||||
if artist:
|
||||
out += " by \x02{}\x0f".format(artist)
|
||||
out += u" by \x02{}\x0f".format(artist)
|
||||
if album:
|
||||
out += " from the album \x02{}\x0f".format(album)
|
||||
out += u" from the album \x02{}\x0f".format(album)
|
||||
|
||||
# append ending based on what type it was
|
||||
out += ending
|
||||
|
|
|
@ -45,7 +45,7 @@ def spotify(inp):
|
|||
except IndexError:
|
||||
return "Could not find track."
|
||||
url = sptfy(gateway.format(type, id))
|
||||
return u"\x02{}\x02 by \x02{}\x02 - \x02{}\x02".format(data["tracks"][0]["name"],
|
||||
return u"\x02{}\x02 by \x02{}\x02 - {}".format(data["tracks"][0]["name"],
|
||||
data["tracks"][0]["artists"][0]["name"], url)
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ def spalbum(inp):
|
|||
except IndexError:
|
||||
return "Could not find album."
|
||||
url = sptfy(gateway.format(type, id))
|
||||
return u"\x02{}\x02 by \x02{}\x02 - \x02{}\x02".format(data["albums"][0]["name"],
|
||||
return u"\x02{}\x02 by \x02{}\x02 - {}".format(data["albums"][0]["name"],
|
||||
data["albums"][0]["artists"][0]["name"], url)
|
||||
|
||||
|
||||
|
@ -79,7 +79,7 @@ def spartist(inp):
|
|||
except IndexError:
|
||||
return "Could not find artist."
|
||||
url = sptfy(gateway.format(type, id))
|
||||
return u"\x02{}\x02 - \x02{}\x02".format(data["artists"][0]["name"], url)
|
||||
return u"\x02{}\x02 - {}".format(data["artists"][0]["name"], url)
|
||||
|
||||
|
||||
@hook.regex(*http_re)
|
||||
|
@ -94,13 +94,13 @@ def spotify_url(match):
|
|||
name = data["track"]["name"]
|
||||
artist = data["track"]["artists"][0]["name"]
|
||||
album = data["track"]["album"]["name"]
|
||||
return u"Spotify Track: \x02{}\x02 by \x02{}\x02 from the album \x02{}\x02 - \x02{}\x02".format(name, artist,
|
||||
return u"Spotify Track: \x02{}\x02 by \x02{}\x02 from the album \x02{}\x02 - {}".format(name, artist,
|
||||
album, sptfy(
|
||||
gateway.format(type, spotify_id)))
|
||||
elif type == "artist":
|
||||
return u"Spotify Artist: \x02{}\x02 - \x02{}\x02".format(data["artist"]["name"],
|
||||
return u"Spotify Artist: \x02{}\x02 - {}".format(data["artist"]["name"],
|
||||
sptfy(gateway.format(type, spotify_id)))
|
||||
elif type == "album":
|
||||
return u"Spotify Album: \x02{}\x02 - \x02{}\x02 - \x02{}\x02".format(data["album"]["artist"],
|
||||
return u"Spotify Album: \x02{}\x02 - \x02{}\x02 - {}".format(data["album"]["artist"],
|
||||
data["album"]["name"],
|
||||
sptfy(gateway.format(type, spotify_id)))
|
||||
|
|
|
@ -42,8 +42,8 @@ def wiki(inp):
|
|||
if title.lower() not in desc.lower():
|
||||
desc = title + desc
|
||||
|
||||
desc = re.sub('\s+', ' ', desc).strip() # remove excess spaces
|
||||
desc = u' '.join(desc.split()) # remove excess spaces
|
||||
|
||||
desc = text.truncate_str(desc, 200)
|
||||
|
||||
return '{} :: {}'.format(desc, http.quote(url, ':/'))
|
||||
return u'{} :: {}'.format(desc, http.quote(url, ':/'))
|
||||
|
|
Reference in a new issue