diff --git a/plugins/steam.py b/plugins/steam.py
index b4230c6..140e780 100644
--- a/plugins/steam.py
+++ b/plugins/steam.py
@@ -63,8 +63,8 @@ def steamcalc(inp, nick='', db=None):
out += soup.findAll('h1', {'class': 'header-title'})[1].text.strip()
except Exception as e:
print e
- return u"\x02Unable to retrieve info for %s!\x02 Is it a valid SteamCommunity profile username (%s)? " \
- "Check if your profile is private, or go here to search: %s" % (
+ return u"\x02Unable to retrieve info for {}!\x02 Is it a valid SteamCommunity profile username ({})? " \
+ "Check if your profile is private, or go here to search: {}".format(
inp, web.try_isgd("http://steamcommunity.com/id/%s" % inp), web.try_isgd(url))
nextone = False
@@ -96,8 +96,8 @@ def steamcalc(inp, nick='', db=None):
notplayed = data[2].text.split(" ")[-1]
nppercent = data[3].text.split(" ")[-1]
time = data[4].text.split(" ")[-1].replace("h", "hours")
- out += " This account is worth \x02%s\x02, and they've spent \x02%s\x02 playing games! " % (money, time)
- out += " They have \x02%s games\x02, but \x02%s of them haven't been touched\x02! That's \x02%s\x02! " % (
+ out += " This account is worth \x02{}\x02, and they've spent \x02{}\x02 playing games! ".format(money, time)
+ out += " They have \x02{} games\x02, but \x02{} of them haven't been touched\x02! That's \x02{}\x02! ".format(
totalgames, notplayed, nppercent)
if not dontsave:
diff --git a/plugins/stock.py b/plugins/stock.py
index 234ac2d..d2d40c5 100755
--- a/plugins/stock.py
+++ b/plugins/stock.py
@@ -27,7 +27,7 @@ def stock(inp):
guess = guess[0]["symbol"]
return stock(guess)
else:
- return "error: unable to get stock info for '%s'" % inp
+ return "error: unable to get stock info for '{}'".format(inp)
if results['last'] == '0.00':
return "%(company)s - last known stock value was 0.00 %(currency)s" \
diff --git a/plugins/system.py b/plugins/system.py
index 40a60f1..e8489d1 100755
--- a/plugins/system.py
+++ b/plugins/system.py
@@ -24,9 +24,9 @@ def system(inp):
python_ver = platform.python_version()
architecture = '-'.join(platform.architecture())
cpu = platform.machine()
- return "Hostname: \x02%s\x02, Operating System: \x02%s\x02, Python " \
- "Version: \x02%s %s\x02, Architecture: \x02%s\x02, CPU: \x02%s" \
- "\x02" % (hostname, os, python_imp, python_ver, architecture, cpu)
+ return "Hostname: \x02{}\x02, Operating System: \x02{}\x02, Python " \
+ "Version: \x02{} {}\x02, Architecture: \x02{}\x02, CPU: \x02{}" \
+ "\x02".format(hostname, os, python_imp, python_ver, architecture, cpu)
@hook.command(autohelp=False)
@@ -41,9 +41,9 @@ def memory(inp):
data = [float(i.replace(' kB', '')) for i in data]
strings = [convert_kilobytes(i) for i in data]
# prepare the output
- out = "Threads: \x02%s\x02, Real Memory: \x02%s\x02, Allocated Memory: \x02%s\x02, Peak " \
- "Allocated Memory: \x02%s\x02, Stack Size: \x02%s\x02, Heap " \
- "Size: \x02%s\x02" % (s['Threads'], strings[0], strings[1], strings[2],
+ out = "Threads: \x02{}\x02, Real Memory: \x02{}\x02, Allocated Memory: \x02{}\x02, Peak " \
+ "Allocated Memory: \x02{}\x02, Stack Size: \x02{}\x02, Heap " \
+ "Size: \x02{}\x02".format(s['Threads'], strings[0], strings[1], strings[2],
strings[3], strings[4])
# return output
return out
@@ -55,7 +55,7 @@ def memory(inp):
for amount in re.findall(r'([,0-9]+) K', out):
memory += float(amount.replace(',', ''))
memory = convert_kilobytes(memory)
- return "Memory Usage: \x02%s\x02" % memory
+ return "Memory Usage: \x02{}\x02".format(memory)
else:
return "Sorry, this command is not supported on your OS."
@@ -66,10 +66,10 @@ def uptime(inp, bot=None):
"""uptime -- Shows the bot's uptime."""
uptime_raw = round(time.time() - bot.start_time)
uptime = timedelta(seconds=uptime_raw)
- return "Uptime: \x02%s\x02" % uptime
+ return "Uptime: \x02{}\x02".format(uptime)
@hook.command(autohelp=False)
def pid(inp):
"""pid -- Prints the bot's PID."""
- return "PID: \x02%s\x02" % os.getpid()
+ return "PID: \x02{}\x02".format(os.getpid())
diff --git a/plugins/tell.py b/plugins/tell.py
index 9bcc7b0..bf0d887 100755
--- a/plugins/tell.py
+++ b/plugins/tell.py
@@ -37,10 +37,10 @@ def tellinput(paraml, input=None, notice=None, db=None, bot=None, nick=None, con
user_from, message, time, chan = tells[0]
reltime = timesince.timesince(time)
- reply = "%s sent you a message %s ago from %s: %s" % (user_from, reltime, chan,
+ reply = "{} sent you a message {} ago from {}: {}".format(user_from, reltime, chan,
message)
if len(tells) > 1:
- reply += " (+%d more, %sshowtells to view)" % (len(tells) - 1, conn.conf["command_prefix"])
+ reply += " (+{} more, {}showtells to view)".format(len(tells) - 1, conn.conf["command_prefix"])
db.execute("delete from tell where user_to=lower(?) and message=?",
(nick, message))
@@ -63,7 +63,7 @@ def showtells(inp, nick='', chan='', notice=None, db=None):
for tell in tells:
user_from, message, time, chan = tell
past = timesince.timesince(time)
- notice("%s sent you a message %s ago from %s: %s" % (user_from, past, chan, message))
+ notice("{} sent you a message {} ago from {}: {}".format(user_from, past, chan, message))
db.execute("delete from tell where user_to=lower(?)",
(nick,))
@@ -92,7 +92,7 @@ def tell(inp, nick='', chan='', db=None, input=None, notice=None):
if user_to.lower() == input.conn.nick.lower():
# user is looking for us, being a smartass
- notice("Thanks for the message, %s!" % user_from)
+ notice("Thanks for the message, {}!".format(user_from))
return
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", user_to.lower()):
diff --git a/plugins/time.py b/plugins/time.py
index b8a18cb..b508522 100755
--- a/plugins/time.py
+++ b/plugins/time.py
@@ -9,7 +9,7 @@ api_url = 'http://api.wolframalpha.com/v2/query?format=plaintext'
def time_command(inp, bot=None):
"""time -- Gets the time in """
- query = "current time in %s" % inp
+ query = "current time in {}".format(inp)
api_key = bot.config.get("api_keys", {}).get("wolframalpha", None)
if not api_key:
@@ -27,9 +27,9 @@ def time_command(inp, bot=None):
place = capitalize_first(" ".join(request.xpath("//pod[@"
"title='Input interpretation']/subpod/plaintext/text()"))[
16:])
- return "%s - \x02%s\x02" % (time, place)
+ return "{} - \x02{}\x02".format(time, place)
else:
- return "Could not get the time for '%s'." % inp
+ return "Could not get the time for '{}'.".format(inp)
@hook.command(autohelp=False)
diff --git a/plugins/todo.py b/plugins/todo.py
index 65c4fce..d18177d 100755
--- a/plugins/todo.py
+++ b/plugins/todo.py
@@ -130,7 +130,7 @@ def todo(inp, nick='', chan='', db=None, notice=None, bot=None):
if not row:
notice("No such entry.")
return
- notice("[%d]: %s: %s" % (index, row[0], row[1]))
+ notice("[{}]: {}: {}".format(index, row[0], row[1]))
elif cmd == 'del' or cmd == 'delete' or cmd == 'remove':
if not len(args):
return "error"
@@ -146,7 +146,7 @@ def todo(inp, nick='', chan='', db=None, notice=None, bot=None):
rows = db_del(db, nick, index)
- notice("Deleted %d entries" % rows.rowcount)
+ notice("Deleted {} entries".format(rows.rowcount))
elif cmd == 'list':
limit = -1
@@ -163,11 +163,11 @@ def todo(inp, nick='', chan='', db=None, notice=None, bot=None):
found = False
for (index, row) in enumerate(rows):
- notice("[%d]: %s: %s" % (index, row[0], row[1]))
+ notice("[{}]: {}: {}".format(index, row[0], row[1]))
found = True
if not found:
- notice("%s has no entries." % nick)
+ notice("{} has no entries.".format(nick))
elif cmd == 'search':
if not len(args):
notice("No search query given!")
@@ -178,11 +178,11 @@ def todo(inp, nick='', chan='', db=None, notice=None, bot=None):
found = False
for (index, row) in enumerate(rows):
- notice("[%d]: %s: %s" % (index, row[0], row[1]))
+ notice("[{}]: {}: {}".format(index, row[0], row[1]))
found = True
if not found:
- notice("%s has no matching entries for: %s" % (nick, query))
+ notice("{} has no matching entries for: {}".format(nick, query))
else:
- notice("Unknown command: %s" % cmd)
+ notice("Unknown command: {}".format(cmd))
diff --git a/plugins/tvdb.py b/plugins/tvdb.py
index 18f02eb..22a5cd7 100755
--- a/plugins/tvdb.py
+++ b/plugins/tvdb.py
@@ -76,9 +76,9 @@ def get_episode_info(episode, api_key):
if episode_name == "TBA":
episode_name = None
- episode_desc = '%s' % episode_num
+ episode_desc = '{}'.format(episode_num)
if episode_name:
- episode_desc += ' - %s' % episode_name
+ episode_desc += ' - {}'.format(episode_name)
return first_aired, airdate, episode_desc
@@ -100,7 +100,7 @@ def tv_next(inp, bot=None):
episodes = episodes["episodes"]
if ended:
- return "%s has ended." % series_name
+ return "{} has ended.".format(series_name)
next_eps = []
today = datetime.date.today()
@@ -114,22 +114,22 @@ def tv_next(inp, bot=None):
(first_aired, airdate, episode_desc) = ep_info
if airdate > today:
- next_eps = ['%s (%s)' % (first_aired, episode_desc)]
+ next_eps = ['{} ({})'.format(first_aired, episode_desc)]
elif airdate == today:
- next_eps = ['Today (%s)' % episode_desc] + next_eps
+ next_eps = ['Today ({})'.format(episode_desc)] + next_eps
else:
#we're iterating in reverse order with newest episodes last
#so, as soon as we're past today, break out of loop
break
if not next_eps:
- return "There are no new episodes scheduled for %s." % series_name
+ return "There are no new episodes scheduled for {}.".format(series_name)
if len(next_eps) == 1:
- return "The next episode of %s airs %s" % (series_name, next_eps[0])
+ return "The next episode of {} airs {}".format(series_name, next_eps[0])
else:
next_eps = ', '.join(next_eps)
- return "The next episodes of %s: %s" % (series_name, next_eps)
+ return "The next episodes of {}: {}".format(series_name, next_eps)
@hook.command
@@ -163,11 +163,11 @@ def tv_last(inp, bot=None):
if airdate < today:
#iterating in reverse order, so the first episode encountered
#before today was the most recently aired
- prev_ep = '%s (%s)' % (first_aired, episode_desc)
+ prev_ep = '{} ({})'.format(first_aired, episode_desc)
break
if not prev_ep:
- return "There are no previously aired episodes for %s." % series_name
+ return "There are no previously aired episodes for {}.".format(series_name)
if ended:
- return '%s ended. The last episode aired %s.' % (series_name, prev_ep)
- return "The last episode of %s aired %s." % (series_name, prev_ep)
+ return '{} ended. The last episode aired {}.'.format(series_name, prev_ep)
+ return "The last episode of {} aired {}.".format(series_name, prev_ep)
diff --git a/plugins/validate.py b/plugins/validate.py
index f0de8c1..56a04fc 100755
--- a/plugins/validate.py
+++ b/plugins/validate.py
@@ -22,5 +22,5 @@ def validate(inp):
if status in ("valid", "invalid"):
errorcount = info['x-w3c-validator-errors']
warningcount = info['x-w3c-validator-warnings']
- return "%s was found to be %s with %s errors and %s warnings." \
- " see: %s" % (inp, status, errorcount, warningcount, url)
+ return "{} was found to be {} with {} errors and {} warnings." \
+ " see: {}".format(inp, status, errorcount, warningcount, url)
diff --git a/plugins/valvesounds.py b/plugins/valvesounds.py
index 2b88312..54d8a6c 100644
--- a/plugins/valvesounds.py
+++ b/plugins/valvesounds.py
@@ -37,7 +37,7 @@ def getSoundInfo(url, inp, jsondata=False):
else:
text = textsplit[i]
if not jsondata:
- return "%s - %s %s" % (newdata[0]["who"],
+ return "{} - {} {}".format(newdata[0]["who"],
text if len(text) < 325 else text[:325] + "...",
web.try_isgd(
url + newdata[0]["id"] if not dostream else url + "sound.php?id=" + newdata[0][
diff --git a/plugins/wikipedia.py b/plugins/wikipedia.py
index 043a708..58984cc 100755
--- a/plugins/wikipedia.py
+++ b/plugins/wikipedia.py
@@ -46,4 +46,4 @@ def wiki(inp):
desc = text.truncate_str(desc, 200)
- return '%s :: %s' % (desc, http.quote(url, ':/'))
+ return '{} :: {}'.format(desc, http.quote(url, ':/'))
diff --git a/plugins/wolframalpha.py b/plugins/wolframalpha.py
index d4578f5..879b771 100755
--- a/plugins/wolframalpha.py
+++ b/plugins/wolframalpha.py
@@ -54,4 +54,4 @@ def wolframalpha(inp, bot=None):
if not ret:
return 'No results.'
- return "%s - %s" % (ret, short_url)
+ return "{} - {}".format(ret, short_url)