@@ -28,7 +28,7 @@ class AFCPending(Command): | |||
commands = ["pending", "pend"] | |||
def process(self, data): | |||
msg1 = "pending submissions status page: http://enwp.org/WP:AFC/ST" | |||
msg2 = "pending submissions category: http://enwp.org/CAT:PEND" | |||
msg1 = "Pending submissions status page: http://enwp.org/WP:AFC/ST" | |||
msg2 = "Pending submissions category: http://enwp.org/CAT:PEND" | |||
self.reply(data, msg1) | |||
self.reply(data, msg2) |
@@ -41,7 +41,7 @@ class AFCReport(Command): | |||
return | |||
if not data.args: | |||
msg = "what submission do you want me to give information about?" | |||
msg = "What submission do you want me to give information about?" | |||
self.reply(data, msg) | |||
return | |||
@@ -66,7 +66,7 @@ class AFCReport(Command): | |||
if page: | |||
return self.report(page) | |||
self.reply(data, "submission \x0302{0}\x0F not found.".format(title)) | |||
self.reply(data, "Submission \x0302{0}\x0F not found.".format(title)) | |||
def get_page(self, title): | |||
page = self.site.get_page(title, follow_redirects=False) | |||
@@ -54,17 +54,17 @@ class AFCStatus(Command): | |||
action = data.args[0].lower() | |||
if action.startswith("sub") or action == "s": | |||
subs = self.count_submissions() | |||
msg = "there are \x0305{0}\x0F pending AfC submissions (\x0302WP:AFC\x0F)." | |||
msg = "There are \x0305{0}\x0F pending AfC submissions (\x0302WP:AFC\x0F)." | |||
self.reply(data, msg.format(subs)) | |||
elif action.startswith("redir") or action == "r": | |||
redirs = self.count_redirects() | |||
msg = "there are \x0305{0}\x0F open redirect requests (\x0302WP:AFC/R\x0F)." | |||
msg = "There are \x0305{0}\x0F open redirect requests (\x0302WP:AFC/R\x0F)." | |||
self.reply(data, msg.format(redirs)) | |||
elif action.startswith("file") or action == "f": | |||
files = self.count_redirects() | |||
msg = "there are \x0305{0}\x0F open file upload requests (\x0302WP:FFU\x0F)." | |||
msg = "There are \x0305{0}\x0F open file upload requests (\x0302WP:FFU\x0F)." | |||
self.reply(data, msg.format(files)) | |||
elif action.startswith("agg") or action == "a": | |||
@@ -79,14 +79,14 @@ class AFCStatus(Command): | |||
self.reply(data, msg.format(data.args[1])) | |||
return | |||
aggregate = self.get_aggregate(agg_num) | |||
msg = "aggregate is \x0305{0}\x0F (AfC {1})." | |||
msg = "Aggregate is \x0305{0}\x0F (AfC {1})." | |||
self.reply(data, msg.format(agg_num, aggregate)) | |||
elif action.startswith("nocolor") or action == "n": | |||
self.reply(data, self.get_status(color=False)) | |||
else: | |||
msg = "unknown argument: \x0303{0}\x0F. Valid args are 'subs', 'redirs', 'files', 'agg', 'nocolor'." | |||
msg = "Unknown argument: \x0303{0}\x0F. Valid args are 'subs', 'redirs', 'files', 'agg', 'nocolor'." | |||
self.reply(data, msg.format(data.args[0])) | |||
else: | |||
@@ -42,10 +42,10 @@ class AFCSubmissions(Command): | |||
try: | |||
number = int(data.args[0]) | |||
except ValueError: | |||
self.reply(data, "argument must be a number.") | |||
self.reply(data, "Argument must be a number.") | |||
return | |||
if number > 5: | |||
msg = "cannot get more than five submissions at a time." | |||
msg = "Cannot get more than five submissions at a time." | |||
self.reply(data, msg) | |||
return | |||
else: | |||
@@ -32,7 +32,7 @@ class Calc(Command): | |||
def process(self, data): | |||
if not data.args: | |||
self.reply(data, "what do you want me to calculate?") | |||
self.reply(data, "What do you want me to calculate?") | |||
return | |||
query = ' '.join(data.args) | |||
@@ -30,11 +30,11 @@ class ChanOps(Command): | |||
def process(self, data): | |||
if data.command == "chanops": | |||
msg = "available commands are !voice, !devoice, !op, !deop, !join, and !part." | |||
msg = "Available commands are !voice, !devoice, !op, !deop, !join, and !part." | |||
self.reply(data, msg) | |||
return | |||
if data.host not in self.config.irc["permissions"]["admins"]: | |||
self.reply(data, "you must be a bot admin to use this command.") | |||
self.reply(data, "You must be a bot admin to use this command.") | |||
return | |||
if data.command == "join": | |||
@@ -59,7 +59,7 @@ class ChanOps(Command): | |||
if not channel.startswith("#"): | |||
channel = "#" + channel | |||
else: | |||
msg = "you must specify a channel to join or part from." | |||
msg = "You must specify a channel to join or part from." | |||
self.reply(data, msg) | |||
return | |||
@@ -34,12 +34,12 @@ class Crypt(Command): | |||
def process(self, data): | |||
if data.command == "crypt": | |||
msg = "available commands are !hash, !encrypt, and !decrypt." | |||
msg = "Available commands are !hash, !encrypt, and !decrypt." | |||
self.reply(data, msg) | |||
return | |||
if not data.args: | |||
msg = "what do you want me to {0}?".format(data.command) | |||
msg = "What do you want me to {0}?".format(data.command) | |||
self.reply(data, msg) | |||
return | |||
@@ -47,14 +47,14 @@ class Crypt(Command): | |||
algo = data.args[0] | |||
if algo == "list": | |||
algos = ', '.join(hashlib.algorithms) | |||
msg = algos.join(("supported algorithms: ", ".")) | |||
msg = algos.join(("Supported algorithms: ", ".")) | |||
self.reply(data, msg) | |||
elif algo in hashlib.algorithms: | |||
string = ' '.join(data.args[1:]) | |||
result = getattr(hashlib, algo)(string).hexdigest() | |||
self.reply(data, result) | |||
else: | |||
msg = "unknown algorithm: '{0}'.".format(algo) | |||
msg = "Unknown algorithm: '{0}'.".format(algo) | |||
self.reply(data, msg) | |||
else: | |||
@@ -62,7 +62,7 @@ class Crypt(Command): | |||
text = " ".join(data.args[1:]) | |||
if not text: | |||
msg = "a key was provided, but text to {0} was not." | |||
msg = "A key was provided, but text to {0} was not." | |||
self.reply(data, msg.format(data.command)) | |||
return | |||
@@ -32,7 +32,7 @@ class Dictionary(Command): | |||
def process(self, data): | |||
if not data.args: | |||
self.reply(data, "what do you want me to define?") | |||
self.reply(data, "What do you want me to define?") | |||
return | |||
term = " ".join(data.args) | |||
@@ -40,7 +40,7 @@ class Dictionary(Command): | |||
try: | |||
defined = self.define(term, lang) | |||
except exceptions.APIError: | |||
msg = "cannot find a {0}-language Wiktionary." | |||
msg = "Cannot find a {0}-language Wiktionary." | |||
self.reply(data, msg.format(lang)) | |||
else: | |||
self.reply(data, defined.encode("utf8")) | |||
@@ -59,11 +59,11 @@ class Dictionary(Command): | |||
return self.define(term.lower(), lang, tries - 1) | |||
if term.capitalize() != term and tries: | |||
return self.define(term.capitalize(), lang, tries - 1) | |||
return "no definition found." | |||
return "No definition found." | |||
level, languages = self.get_languages(entry) | |||
if not languages: | |||
return u"couldn't parse {0}!".format(page.url) | |||
return u"Couldn't parse {0}!".format(page.url) | |||
result = [] | |||
for lang, section in sorted(languages.items()): | |||
@@ -42,7 +42,7 @@ class Editcount(Command): | |||
try: | |||
count = user.editcount | |||
except exceptions.UserNotFoundError: | |||
msg = "the user \x0302{0}\x0F does not exist." | |||
msg = "The user \x0302{0}\x0F does not exist." | |||
self.reply(data, msg.format(name)) | |||
return | |||
@@ -41,7 +41,7 @@ class Geolocate(Command): | |||
def process(self, data): | |||
if not data.args: | |||
self.reply(data, "please specify an IP to lookup.") | |||
self.reply(data, "Please specify an IP to lookup.") | |||
return | |||
if not self.key: | |||
@@ -40,14 +40,14 @@ class Git(Command): | |||
def process(self, data): | |||
self.data = data | |||
if data.host not in self.config.irc["permissions"]["owners"]: | |||
msg = "you must be a bot owner to use this command." | |||
msg = "You must be a bot owner to use this command." | |||
self.reply(data, msg) | |||
return | |||
if not data.args or data.args[0] == "help": | |||
self.do_help() | |||
return | |||
if not self.repos: | |||
self.reply(data, "no repos are specified in the config file.") | |||
self.reply(data, "No repos are specified in the config file.") | |||
return | |||
command = data.args[0] | |||
@@ -55,12 +55,12 @@ class Git(Command): | |||
repo_name = data.args[1] | |||
except IndexError: | |||
repos = self.get_repos() | |||
msg = "which repo do you want to work with (options are {0})?" | |||
msg = "Which repo do you want to work with (options are {0})?" | |||
self.reply(data, msg.format(repos)) | |||
return | |||
if repo_name not in self.repos: | |||
repos = self.get_repos() | |||
msg = "repository must be one of the following: {0}." | |||
msg = "Repository must be one of the following: {0}." | |||
self.reply(data, msg.format(repos)) | |||
return | |||
self.repo = git.Repo(self.repos[repo_name]) | |||
@@ -78,7 +78,7 @@ class Git(Command): | |||
elif command == "status": | |||
self.do_status() | |||
else: # They asked us to do something we don't know | |||
msg = "unknown argument: \x0303{0}\x0F.".format(data.args[0]) | |||
msg = "Ynknown argument: \x0303{0}\x0F.".format(data.args[0]) | |||
self.reply(data, msg) | |||
def get_repos(self): | |||
@@ -94,7 +94,7 @@ class Git(Command): | |||
try: | |||
return getattr(self.repo.remotes, remote_name) | |||
except AttributeError: | |||
msg = "unknown remote: \x0302{0}\x0F.".format(remote_name) | |||
msg = "Unknown remote: \x0302{0}\x0F.".format(remote_name) | |||
self.reply(self.data, msg) | |||
def get_time_since(self, date): | |||
@@ -121,19 +121,19 @@ class Git(Command): | |||
for key in sorted(help.keys()): | |||
subcommands += "\x0303{0}\x0F ({1}), ".format(key, help[key]) | |||
subcommands = subcommands[:-2] # Trim last comma and space | |||
msg = "sub-commands are: {0}; repos are: {1}. Syntax: !git \x0303subcommand\x0F \x0302repo\x0F." | |||
msg = "Sub-commands are: {0}; repos are: {1}. Syntax: !git \x0303subcommand\x0F \x0302repo\x0F." | |||
self.reply(self.data, msg.format(subcommands, self.get_repos())) | |||
def do_branch(self): | |||
"""Get our current branch.""" | |||
branch = self.repo.active_branch.name | |||
msg = "currently on branch \x0302{0}\x0F.".format(branch) | |||
msg = "Currently on branch \x0302{0}\x0F.".format(branch) | |||
self.reply(self.data, msg) | |||
def do_branches(self): | |||
"""Get a list of branches.""" | |||
branches = [branch.name for branch in self.repo.branches] | |||
msg = "branches: \x0302{0}\x0F.".format(", ".join(branches)) | |||
msg = "Branches: \x0302{0}\x0F.".format(", ".join(branches)) | |||
self.reply(self.data, msg) | |||
def do_checkout(self): | |||
@@ -141,23 +141,23 @@ class Git(Command): | |||
try: | |||
target = self.data.args[2] | |||
except IndexError: # No branch name provided | |||
self.reply(self.data, "switch to which branch?") | |||
self.reply(self.data, "Wwitch to which branch?") | |||
return | |||
current_branch = self.repo.active_branch.name | |||
if target == current_branch: | |||
msg = "already on \x0302{0}\x0F!".format(target) | |||
msg = "Already on \x0302{0}\x0F!".format(target) | |||
self.reply(self.data, msg) | |||
return | |||
try: | |||
ref = getattr(self.repo.branches, target) | |||
except AttributeError: | |||
msg = "branch \x0302{0}\x0F doesn't exist!".format(target) | |||
msg = "Branch \x0302{0}\x0F doesn't exist!".format(target) | |||
self.reply(self.data, msg) | |||
else: | |||
ref.checkout() | |||
ms = "switched from branch \x0302{0}\x0F to \x0302{1}\x0F." | |||
ms = "Switched from branch \x0302{0}\x0F to \x0302{1}\x0F." | |||
msg = ms.format(current_branch, target) | |||
self.reply(self.data, msg) | |||
log = "{0} checked out branch {1} of {2}" | |||
@@ -169,23 +169,23 @@ class Git(Command): | |||
try: | |||
target = self.data.args[2] | |||
except IndexError: # No branch name provided | |||
self.reply(self.data, "delete which branch?") | |||
self.reply(self.data, "Delete which branch?") | |||
return | |||
current_branch = self.repo.active_branch.name | |||
if current_branch == target: | |||
msg = "you're currently on this branch; please checkout to a different branch before deleting." | |||
msg = "You're currently on this branch; please checkout to a different branch before deleting." | |||
self.reply(self.data, msg) | |||
return | |||
try: | |||
ref = getattr(self.repo.branches, target) | |||
except AttributeError: | |||
msg = "branch \x0302{0}\x0F doesn't exist!".format(target) | |||
msg = "Branch \x0302{0}\x0F doesn't exist!".format(target) | |||
self.reply(self.data, msg) | |||
else: | |||
self.repo.git.branch("-d", ref) | |||
msg = "branch \x0302{0}\x0F has been deleted locally." | |||
msg = "Branch \x0302{0}\x0F has been deleted locally." | |||
self.reply(self.data, msg.format(target)) | |||
log = "{0} deleted branch {1} of {2}" | |||
logmsg = log.format(self.data.nick, target, self.repo.working_dir) | |||
@@ -194,7 +194,7 @@ class Git(Command): | |||
def do_pull(self): | |||
"""Pull from our remote repository.""" | |||
branch = self.repo.active_branch.name | |||
msg = "pulling from remote (currently on \x0302{0}\x0F)..." | |||
msg = "Pulling from remote (currently on \x0302{0}\x0F)..." | |||
self.reply(self.data, msg.format(branch)) | |||
remote = self.get_remote() | |||
@@ -205,13 +205,13 @@ class Git(Command): | |||
if updated: | |||
branches = ", ".join([info.ref.remote_head for info in updated]) | |||
msg = "done; updates to \x0302{0}\x0F (from {1})." | |||
msg = "Done; updates to \x0302{0}\x0F (from {1})." | |||
self.reply(self.data, msg.format(branches, remote.url)) | |||
log = "{0} pulled {1} of {2} (updates to {3})" | |||
self.logger.info(log.format(self.data.nick, remote.name, | |||
self.repo.working_dir, branches)) | |||
else: | |||
self.reply(self.data, "done; no new changes.") | |||
self.reply(self.data, "Done; no new changes.") | |||
log = "{0} pulled {1} of {2} (no updates)" | |||
self.logger.info(log.format(self.data.nick, remote.name, | |||
self.repo.working_dir)) | |||
@@ -227,13 +227,13 @@ class Git(Command): | |||
if updated: | |||
branches = ", ".join([info.ref.remote_head for info in updated]) | |||
msg = "last local commit was \x02{0}\x0F ago; updates to \x0302{1}\x0F." | |||
msg = "Last local commit was \x02{0}\x0F ago; updates to \x0302{1}\x0F." | |||
self.reply(self.data, msg.format(since, branches)) | |||
log = "{0} got status of {1} of {2} (updates to {3})" | |||
self.logger.info(log.format(self.data.nick, remote.name, | |||
self.repo.working_dir, branches)) | |||
else: | |||
msg = "last commit was \x02{0}\x0F ago. Local copy is up-to-date with remote." | |||
msg = "Last commit was \x02{0}\x0F ago. Local copy is up-to-date with remote." | |||
self.reply(self.data, msg.format(since)) | |||
log = "{0} pulled {1} of {2} (no updates)" | |||
self.logger.info(log.format(self.data.nick, remote.name, | |||
@@ -60,11 +60,11 @@ class Help(Command): | |||
if command.__doc__: | |||
doc = command.__doc__.replace("\n", "") | |||
doc = re.sub("\s\s+", " ", doc) | |||
msg = 'help for command \x0303{0}\x0F: "{1}"' | |||
msg = 'Help for command \x0303{0}\x0F: "{1}"' | |||
self.reply(data, msg.format(target, doc)) | |||
return | |||
msg = "sorry, no help for \x0303{0}\x0F.".format(target) | |||
msg = "Sorry, no help for \x0303{0}\x0F.".format(target) | |||
self.reply(data, msg) | |||
def do_hello(self, data): | |||
@@ -48,7 +48,7 @@ class Lag(Command): | |||
if len(data.args) > 1: | |||
name = " ".join(data.args) | |||
self.reply(data, "unknown site: \x0302{0}\x0F.".format(name)) | |||
self.reply(data, "Unknown site: \x0302{0}\x0F.".format(name)) | |||
return | |||
name = data.args[0] | |||
if "." in name: | |||
@@ -59,7 +59,7 @@ class Lag(Command): | |||
try: | |||
return self.bot.wiki.get_site(name) | |||
except exceptions.SiteNotFoundError: | |||
msg = "unknown site: \x0302{0}\x0F.".format(name) | |||
msg = "Unknown site: \x0302{0}\x0F.".format(name) | |||
self.reply(data, msg) | |||
return | |||
return self.get_site_from_proj_and_lang(data, project, lang) | |||
@@ -71,7 +71,7 @@ class Lag(Command): | |||
try: | |||
site = self.bot.wiki.add_site(project=project, lang=lang) | |||
except exceptions.APIError: | |||
msg = "site \x0302{0}:{1}\x0F not found." | |||
msg = "Site \x0302{0}:{1}\x0F not found." | |||
self.reply(data, msg.format(project, lang)) | |||
return | |||
return site | |||
@@ -30,7 +30,7 @@ class Langcode(Command): | |||
def process(self, data): | |||
if not data.args: | |||
self.reply(data, "please specify a language code.") | |||
self.reply(data, "Please specify a language code.") | |||
return | |||
code = data.args[0] | |||
@@ -50,4 +50,4 @@ class Langcode(Command): | |||
self.reply(data, msg) | |||
return | |||
self.reply(data, "language \x0302{0}\x0F not found.".format(code)) | |||
self.reply(data, "Language \x0302{0}\x0F not found.".format(code)) |
@@ -39,7 +39,7 @@ class Link(Command): | |||
elif data.command == "link": | |||
if not data.args: | |||
self.reply(data, "what do you want me to link to?") | |||
self.reply(data, "What do you want me to link to?") | |||
return | |||
pagename = " ".join(data.args) | |||
link = self.site.get_page(pagename).url.encode("utf8") | |||
@@ -44,5 +44,5 @@ class Praise(Command): | |||
if not data.args: | |||
msg = "You use this command to praise certain people. Who they are is a secret." | |||
else: | |||
msg = "you're doing it wrong." | |||
msg = "You're doing it wrong." | |||
self.reply(data, msg) |
@@ -30,7 +30,7 @@ class Quit(Command): | |||
def process(self, data): | |||
if data.host not in self.config.irc["permissions"]["owners"]: | |||
self.reply(data, "you must be a bot owner to use this command.") | |||
self.reply(data, "You must be a bot owner to use this command.") | |||
return | |||
if data.command == "quit": | |||
self.do_quit(data) | |||
@@ -45,7 +45,7 @@ class Quit(Command): | |||
reason = " ".join(args) | |||
else: | |||
if not args or args[0].lower() != data.my_nick: | |||
self.reply(data, "to confirm this action, the first argument must be my name.") | |||
self.reply(data, "To confirm this action, the first argument must be my name.") | |||
return | |||
reason = " ".join(args[1:]) | |||
@@ -42,7 +42,7 @@ class Registration(Command): | |||
try: | |||
reg = user.registration | |||
except exceptions.UserNotFoundError: | |||
msg = "the user \x0302{0}\x0F does not exist." | |||
msg = "The user \x0302{0}\x0F does not exist." | |||
self.reply(data, msg.format(name)) | |||
return | |||
@@ -54,7 +54,7 @@ class Registration(Command): | |||
elif user.gender == "female": | |||
gender = "She's" | |||
else: | |||
gender = "They're" # Singluar they? | |||
gender = "They're" # Singular they? | |||
msg = "\x0302{0}\x0F registered on {1}. {2} {3} old." | |||
self.reply(data, msg.format(name, date, gender, age)) | |||
@@ -32,19 +32,19 @@ class Remind(Command): | |||
def process(self, data): | |||
if not data.args: | |||
msg = "please specify a time (in seconds) and a message in the following format: !remind <time> <msg>." | |||
msg = "Please specify a time (in seconds) and a message in the following format: !remind <time> <msg>." | |||
self.reply(data, msg) | |||
return | |||
try: | |||
wait = int(data.args[0]) | |||
except ValueError: | |||
msg = "the time must be given as an integer, in seconds." | |||
msg = "The time must be given as an integer, in seconds." | |||
self.reply(data, msg) | |||
return | |||
message = ' '.join(data.args[1:]) | |||
if not message: | |||
msg = "what message do you want me to give you when time is up?" | |||
msg = "What message do you want me to give you when time is up?" | |||
self.reply(data, msg) | |||
return | |||
@@ -40,7 +40,7 @@ class Rights(Command): | |||
try: | |||
rights = user.groups | |||
except exceptions.UserNotFoundError: | |||
msg = "the user \x0302{0}\x0F does not exist." | |||
msg = "The user \x0302{0}\x0F does not exist." | |||
self.reply(data, msg.format(name)) | |||
return | |||
@@ -48,5 +48,5 @@ class Rights(Command): | |||
rights.remove("*") # Remove the '*' group given to everyone | |||
except ValueError: | |||
pass | |||
msg = "the rights for \x0302{0}\x0F are {1}." | |||
msg = "The rights for \x0302{0}\x0F are {1}." | |||
self.reply(data, msg.format(name, ', '.join(rights))) |
@@ -34,4 +34,4 @@ class Test(Command): | |||
if hey: | |||
self.say(data.chan, "Hey {0}!".format(user)) | |||
else: | |||
self.say(data.chan, "'sup {0}?".format(user)) | |||
self.say(data.chan, "'Sup {0}?".format(user)) |
@@ -33,7 +33,7 @@ class Threads(Command): | |||
def process(self, data): | |||
self.data = data | |||
if data.host not in self.config.irc["permissions"]["owners"]: | |||
msg = "you must be a bot owner to use this command." | |||
msg = "You must be a bot owner to use this command." | |||
self.reply(data, msg) | |||
return | |||
@@ -41,7 +41,7 @@ class Threads(Command): | |||
if data.command == "tasklist": | |||
self.do_list() | |||
else: | |||
msg = "no arguments provided. Maybe you wanted '!{0} list', '!{0} start', or '!{0} listall'?" | |||
msg = "No arguments provided. Maybe you wanted '!{0} list', '!{0} start', or '!{0} listall'?" | |||
self.reply(data, msg.format(data.command)) | |||
return | |||
@@ -55,7 +55,7 @@ class Threads(Command): | |||
self.do_listall() | |||
else: # They asked us to do something we don't know | |||
msg = "unknown argument: \x0303{0}\x0F.".format(data.args[0]) | |||
msg = "Unknown argument: \x0303{0}\x0F.".format(data.args[0]) | |||
self.reply(data, msg) | |||
def do_list(self): | |||
@@ -128,16 +128,16 @@ class Threads(Command): | |||
try: | |||
task_name = data.args[1] | |||
except IndexError: # No task name given | |||
self.reply(data, "what task do you want me to start?") | |||
self.reply(data, "What task do you want me to start?") | |||
return | |||
if task_name not in [task.name for task in self.bot.tasks]: | |||
# This task does not exist or hasn't been loaded: | |||
msg = "task could not be found; either it doesn't exist, or it wasn't loaded correctly." | |||
msg = "Task could not be found; either it doesn't exist, or it wasn't loaded correctly." | |||
self.reply(data, msg.format(task_name)) | |||
return | |||
data.kwargs["fromIRC"] = True | |||
self.bot.tasks.start(task_name, **data.kwargs) | |||
msg = "task \x0302{0}\x0F started.".format(task_name) | |||
msg = "Task \x0302{0}\x0F started.".format(task_name) | |||
self.reply(data, msg) |
@@ -56,13 +56,13 @@ class Time(Command): | |||
def do_time(self, data, timezone): | |||
if not pytz: | |||
msg = "this command requires the 'pytz' module: http://pytz.sourceforge.net/" | |||
msg = "This command requires the 'pytz' module: http://pytz.sourceforge.net/" | |||
self.reply(data, msg) | |||
return | |||
try: | |||
tzinfo = pytz.timezone(timezone) | |||
except pytz.exceptions.UnknownTimeZoneError: | |||
self.reply(data, "unknown timezone: {0}.".format(timezone)) | |||
self.reply(data, "Unknown timezone: {0}.".format(timezone)) | |||
return | |||
now = pytz.utc.localize(datetime.utcnow()).astimezone(tzinfo) | |||
self.reply(data, now.strftime("%Y-%m-%d %H:%M:%S %Z")) |