Browse Source

Merge pull request #32 from Yulli/develop

Capitalise the beginning of all IRC replies.
tags/v0.1^2
Ben Kurtovic 12 years ago
parent
commit
fc47ef6d92
23 changed files with 75 additions and 75 deletions
  1. +2
    -2
      earwigbot/commands/afc_pending.py
  2. +2
    -2
      earwigbot/commands/afc_report.py
  3. +5
    -5
      earwigbot/commands/afc_status.py
  4. +2
    -2
      earwigbot/commands/afc_submissions.py
  5. +1
    -1
      earwigbot/commands/calc.py
  6. +3
    -3
      earwigbot/commands/chanops.py
  7. +5
    -5
      earwigbot/commands/crypt.py
  8. +4
    -4
      earwigbot/commands/dictionary.py
  9. +1
    -1
      earwigbot/commands/editcount.py
  10. +1
    -1
      earwigbot/commands/geolocate.py
  11. +22
    -22
      earwigbot/commands/git.py
  12. +2
    -2
      earwigbot/commands/help.py
  13. +3
    -3
      earwigbot/commands/lag.py
  14. +2
    -2
      earwigbot/commands/langcode.py
  15. +1
    -1
      earwigbot/commands/link.py
  16. +1
    -1
      earwigbot/commands/praise.py
  17. +2
    -2
      earwigbot/commands/quit.py
  18. +2
    -2
      earwigbot/commands/registration.py
  19. +3
    -3
      earwigbot/commands/remind.py
  20. +2
    -2
      earwigbot/commands/rights.py
  21. +1
    -1
      earwigbot/commands/test.py
  22. +6
    -6
      earwigbot/commands/threads.py
  23. +2
    -2
      earwigbot/commands/time.py

+ 2
- 2
earwigbot/commands/afc_pending.py View File

@@ -28,7 +28,7 @@ class AFCPending(Command):
commands = ["pending", "pend"] commands = ["pending", "pend"]


def process(self, data): 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, msg1)
self.reply(data, msg2) self.reply(data, msg2)

+ 2
- 2
earwigbot/commands/afc_report.py View File

@@ -41,7 +41,7 @@ class AFCReport(Command):
return return


if not data.args: 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) self.reply(data, msg)
return return


@@ -66,7 +66,7 @@ class AFCReport(Command):
if page: if page:
return self.report(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): def get_page(self, title):
page = self.site.get_page(title, follow_redirects=False) page = self.site.get_page(title, follow_redirects=False)


+ 5
- 5
earwigbot/commands/afc_status.py View File

@@ -54,17 +54,17 @@ class AFCStatus(Command):
action = data.args[0].lower() action = data.args[0].lower()
if action.startswith("sub") or action == "s": if action.startswith("sub") or action == "s":
subs = self.count_submissions() 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)) self.reply(data, msg.format(subs))


elif action.startswith("redir") or action == "r": elif action.startswith("redir") or action == "r":
redirs = self.count_redirects() 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)) self.reply(data, msg.format(redirs))


elif action.startswith("file") or action == "f": elif action.startswith("file") or action == "f":
files = self.count_redirects() 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)) self.reply(data, msg.format(files))


elif action.startswith("agg") or action == "a": elif action.startswith("agg") or action == "a":
@@ -79,14 +79,14 @@ class AFCStatus(Command):
self.reply(data, msg.format(data.args[1])) self.reply(data, msg.format(data.args[1]))
return return
aggregate = self.get_aggregate(agg_num) 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)) self.reply(data, msg.format(agg_num, aggregate))


elif action.startswith("nocolor") or action == "n": elif action.startswith("nocolor") or action == "n":
self.reply(data, self.get_status(color=False)) self.reply(data, self.get_status(color=False))


else: 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])) self.reply(data, msg.format(data.args[0]))


else: else:


+ 2
- 2
earwigbot/commands/afc_submissions.py View File

@@ -42,10 +42,10 @@ class AFCSubmissions(Command):
try: try:
number = int(data.args[0]) number = int(data.args[0])
except ValueError: except ValueError:
self.reply(data, "argument must be a number.")
self.reply(data, "Argument must be a number.")
return return
if number > 5: 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) self.reply(data, msg)
return return
else: else:


+ 1
- 1
earwigbot/commands/calc.py View File

@@ -32,7 +32,7 @@ class Calc(Command):


def process(self, data): def process(self, data):
if not data.args: 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 return


query = ' '.join(data.args) query = ' '.join(data.args)


+ 3
- 3
earwigbot/commands/chanops.py View File

@@ -30,11 +30,11 @@ class ChanOps(Command):


def process(self, data): def process(self, data):
if data.command == "chanops": 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) self.reply(data, msg)
return return
if data.host not in self.config.irc["permissions"]["admins"]: 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 return


if data.command == "join": if data.command == "join":
@@ -59,7 +59,7 @@ class ChanOps(Command):
if not channel.startswith("#"): if not channel.startswith("#"):
channel = "#" + channel channel = "#" + channel
else: 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) self.reply(data, msg)
return return




+ 5
- 5
earwigbot/commands/crypt.py View File

@@ -34,12 +34,12 @@ class Crypt(Command):


def process(self, data): def process(self, data):
if data.command == "crypt": if data.command == "crypt":
msg = "available commands are !hash, !encrypt, and !decrypt."
msg = "Available commands are !hash, !encrypt, and !decrypt."
self.reply(data, msg) self.reply(data, msg)
return return


if not data.args: 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) self.reply(data, msg)
return return


@@ -47,14 +47,14 @@ class Crypt(Command):
algo = data.args[0] algo = data.args[0]
if algo == "list": if algo == "list":
algos = ', '.join(hashlib.algorithms) algos = ', '.join(hashlib.algorithms)
msg = algos.join(("supported algorithms: ", "."))
msg = algos.join(("Supported algorithms: ", "."))
self.reply(data, msg) self.reply(data, msg)
elif algo in hashlib.algorithms: elif algo in hashlib.algorithms:
string = ' '.join(data.args[1:]) string = ' '.join(data.args[1:])
result = getattr(hashlib, algo)(string).hexdigest() result = getattr(hashlib, algo)(string).hexdigest()
self.reply(data, result) self.reply(data, result)
else: else:
msg = "unknown algorithm: '{0}'.".format(algo)
msg = "Unknown algorithm: '{0}'.".format(algo)
self.reply(data, msg) self.reply(data, msg)


else: else:
@@ -62,7 +62,7 @@ class Crypt(Command):
text = " ".join(data.args[1:]) text = " ".join(data.args[1:])


if not text: 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)) self.reply(data, msg.format(data.command))
return return




+ 4
- 4
earwigbot/commands/dictionary.py View File

@@ -32,7 +32,7 @@ class Dictionary(Command):


def process(self, data): def process(self, data):
if not data.args: 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 return


term = " ".join(data.args) term = " ".join(data.args)
@@ -40,7 +40,7 @@ class Dictionary(Command):
try: try:
defined = self.define(term, lang) defined = self.define(term, lang)
except exceptions.APIError: except exceptions.APIError:
msg = "cannot find a {0}-language Wiktionary."
msg = "Cannot find a {0}-language Wiktionary."
self.reply(data, msg.format(lang)) self.reply(data, msg.format(lang))
else: else:
self.reply(data, defined.encode("utf8")) self.reply(data, defined.encode("utf8"))
@@ -59,11 +59,11 @@ class Dictionary(Command):
return self.define(term.lower(), lang, tries - 1) return self.define(term.lower(), lang, tries - 1)
if term.capitalize() != term and tries: if term.capitalize() != term and tries:
return self.define(term.capitalize(), lang, tries - 1) return self.define(term.capitalize(), lang, tries - 1)
return "no definition found."
return "No definition found."


level, languages = self.get_languages(entry) level, languages = self.get_languages(entry)
if not languages: if not languages:
return u"couldn't parse {0}!".format(page.url)
return u"Couldn't parse {0}!".format(page.url)


result = [] result = []
for lang, section in sorted(languages.items()): for lang, section in sorted(languages.items()):


+ 1
- 1
earwigbot/commands/editcount.py View File

@@ -42,7 +42,7 @@ class Editcount(Command):
try: try:
count = user.editcount count = user.editcount
except exceptions.UserNotFoundError: 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)) self.reply(data, msg.format(name))
return return




+ 1
- 1
earwigbot/commands/geolocate.py View File

@@ -41,7 +41,7 @@ class Geolocate(Command):


def process(self, data): def process(self, data):
if not data.args: if not data.args:
self.reply(data, "please specify an IP to lookup.")
self.reply(data, "Please specify an IP to lookup.")
return return


if not self.key: if not self.key:


+ 22
- 22
earwigbot/commands/git.py View File

@@ -40,14 +40,14 @@ class Git(Command):
def process(self, data): def process(self, data):
self.data = data self.data = data
if data.host not in self.config.irc["permissions"]["owners"]: 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) self.reply(data, msg)
return return
if not data.args or data.args[0] == "help": if not data.args or data.args[0] == "help":
self.do_help() self.do_help()
return return
if not self.repos: 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 return


command = data.args[0] command = data.args[0]
@@ -55,12 +55,12 @@ class Git(Command):
repo_name = data.args[1] repo_name = data.args[1]
except IndexError: except IndexError:
repos = self.get_repos() 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)) self.reply(data, msg.format(repos))
return return
if repo_name not in self.repos: if repo_name not in self.repos:
repos = self.get_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)) self.reply(data, msg.format(repos))
return return
self.repo = git.Repo(self.repos[repo_name]) self.repo = git.Repo(self.repos[repo_name])
@@ -78,7 +78,7 @@ class Git(Command):
elif command == "status": elif command == "status":
self.do_status() self.do_status()
else: # They asked us to do something we don't know 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) self.reply(data, msg)


def get_repos(self): def get_repos(self):
@@ -94,7 +94,7 @@ class Git(Command):
try: try:
return getattr(self.repo.remotes, remote_name) return getattr(self.repo.remotes, remote_name)
except AttributeError: 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) self.reply(self.data, msg)


def get_time_since(self, date): def get_time_since(self, date):
@@ -121,19 +121,19 @@ class Git(Command):
for key in sorted(help.keys()): for key in sorted(help.keys()):
subcommands += "\x0303{0}\x0F ({1}), ".format(key, help[key]) subcommands += "\x0303{0}\x0F ({1}), ".format(key, help[key])
subcommands = subcommands[:-2] # Trim last comma and space 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())) self.reply(self.data, msg.format(subcommands, self.get_repos()))


def do_branch(self): def do_branch(self):
"""Get our current branch.""" """Get our current branch."""
branch = self.repo.active_branch.name 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) self.reply(self.data, msg)


def do_branches(self): def do_branches(self):
"""Get a list of branches.""" """Get a list of branches."""
branches = [branch.name for branch in self.repo.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) self.reply(self.data, msg)


def do_checkout(self): def do_checkout(self):
@@ -141,23 +141,23 @@ class Git(Command):
try: try:
target = self.data.args[2] target = self.data.args[2]
except IndexError: # No branch name provided except IndexError: # No branch name provided
self.reply(self.data, "switch to which branch?")
self.reply(self.data, "Wwitch to which branch?")
return return


current_branch = self.repo.active_branch.name current_branch = self.repo.active_branch.name
if target == current_branch: 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) self.reply(self.data, msg)
return return


try: try:
ref = getattr(self.repo.branches, target) ref = getattr(self.repo.branches, target)
except AttributeError: 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) self.reply(self.data, msg)
else: else:
ref.checkout() 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) msg = ms.format(current_branch, target)
self.reply(self.data, msg) self.reply(self.data, msg)
log = "{0} checked out branch {1} of {2}" log = "{0} checked out branch {1} of {2}"
@@ -169,23 +169,23 @@ class Git(Command):
try: try:
target = self.data.args[2] target = self.data.args[2]
except IndexError: # No branch name provided except IndexError: # No branch name provided
self.reply(self.data, "delete which branch?")
self.reply(self.data, "Delete which branch?")
return return


current_branch = self.repo.active_branch.name current_branch = self.repo.active_branch.name
if current_branch == target: 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) self.reply(self.data, msg)
return return


try: try:
ref = getattr(self.repo.branches, target) ref = getattr(self.repo.branches, target)
except AttributeError: 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) self.reply(self.data, msg)
else: else:
self.repo.git.branch("-d", ref) 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)) self.reply(self.data, msg.format(target))
log = "{0} deleted branch {1} of {2}" log = "{0} deleted branch {1} of {2}"
logmsg = log.format(self.data.nick, target, self.repo.working_dir) logmsg = log.format(self.data.nick, target, self.repo.working_dir)
@@ -194,7 +194,7 @@ class Git(Command):
def do_pull(self): def do_pull(self):
"""Pull from our remote repository.""" """Pull from our remote repository."""
branch = self.repo.active_branch.name 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)) self.reply(self.data, msg.format(branch))


remote = self.get_remote() remote = self.get_remote()
@@ -205,13 +205,13 @@ class Git(Command):


if updated: if updated:
branches = ", ".join([info.ref.remote_head for info in 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)) self.reply(self.data, msg.format(branches, remote.url))
log = "{0} pulled {1} of {2} (updates to {3})" log = "{0} pulled {1} of {2} (updates to {3})"
self.logger.info(log.format(self.data.nick, remote.name, self.logger.info(log.format(self.data.nick, remote.name,
self.repo.working_dir, branches)) self.repo.working_dir, branches))
else: 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)" log = "{0} pulled {1} of {2} (no updates)"
self.logger.info(log.format(self.data.nick, remote.name, self.logger.info(log.format(self.data.nick, remote.name,
self.repo.working_dir)) self.repo.working_dir))
@@ -227,13 +227,13 @@ class Git(Command):


if updated: if updated:
branches = ", ".join([info.ref.remote_head for info in 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)) self.reply(self.data, msg.format(since, branches))
log = "{0} got status of {1} of {2} (updates to {3})" log = "{0} got status of {1} of {2} (updates to {3})"
self.logger.info(log.format(self.data.nick, remote.name, self.logger.info(log.format(self.data.nick, remote.name,
self.repo.working_dir, branches)) self.repo.working_dir, branches))
else: 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)) self.reply(self.data, msg.format(since))
log = "{0} pulled {1} of {2} (no updates)" log = "{0} pulled {1} of {2} (no updates)"
self.logger.info(log.format(self.data.nick, remote.name, self.logger.info(log.format(self.data.nick, remote.name,


+ 2
- 2
earwigbot/commands/help.py View File

@@ -60,11 +60,11 @@ class Help(Command):
if command.__doc__: if command.__doc__:
doc = command.__doc__.replace("\n", "") doc = command.__doc__.replace("\n", "")
doc = re.sub("\s\s+", " ", doc) 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)) self.reply(data, msg.format(target, doc))
return 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) self.reply(data, msg)


def do_hello(self, data): def do_hello(self, data):


+ 3
- 3
earwigbot/commands/lag.py View File

@@ -48,7 +48,7 @@ class Lag(Command):


if len(data.args) > 1: if len(data.args) > 1:
name = " ".join(data.args) 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 return
name = data.args[0] name = data.args[0]
if "." in name: if "." in name:
@@ -59,7 +59,7 @@ class Lag(Command):
try: try:
return self.bot.wiki.get_site(name) return self.bot.wiki.get_site(name)
except exceptions.SiteNotFoundError: except exceptions.SiteNotFoundError:
msg = "unknown site: \x0302{0}\x0F.".format(name)
msg = "Unknown site: \x0302{0}\x0F.".format(name)
self.reply(data, msg) self.reply(data, msg)
return return
return self.get_site_from_proj_and_lang(data, project, lang) return self.get_site_from_proj_and_lang(data, project, lang)
@@ -71,7 +71,7 @@ class Lag(Command):
try: try:
site = self.bot.wiki.add_site(project=project, lang=lang) site = self.bot.wiki.add_site(project=project, lang=lang)
except exceptions.APIError: 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)) self.reply(data, msg.format(project, lang))
return return
return site return site


+ 2
- 2
earwigbot/commands/langcode.py View File

@@ -30,7 +30,7 @@ class Langcode(Command):


def process(self, data): def process(self, data):
if not data.args: if not data.args:
self.reply(data, "please specify a language code.")
self.reply(data, "Please specify a language code.")
return return


code = data.args[0] code = data.args[0]
@@ -50,4 +50,4 @@ class Langcode(Command):
self.reply(data, msg) self.reply(data, msg)
return return


self.reply(data, "language \x0302{0}\x0F not found.".format(code))
self.reply(data, "Language \x0302{0}\x0F not found.".format(code))

+ 1
- 1
earwigbot/commands/link.py View File

@@ -39,7 +39,7 @@ class Link(Command):


elif data.command == "link": elif data.command == "link":
if not data.args: 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 return
pagename = " ".join(data.args) pagename = " ".join(data.args)
link = self.site.get_page(pagename).url.encode("utf8") link = self.site.get_page(pagename).url.encode("utf8")


+ 1
- 1
earwigbot/commands/praise.py View File

@@ -44,5 +44,5 @@ class Praise(Command):
if not data.args: if not data.args:
msg = "You use this command to praise certain people. Who they are is a secret." msg = "You use this command to praise certain people. Who they are is a secret."
else: else:
msg = "you're doing it wrong."
msg = "You're doing it wrong."
self.reply(data, msg) self.reply(data, msg)

+ 2
- 2
earwigbot/commands/quit.py View File

@@ -30,7 +30,7 @@ class Quit(Command):


def process(self, data): def process(self, data):
if data.host not in self.config.irc["permissions"]["owners"]: 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 return
if data.command == "quit": if data.command == "quit":
self.do_quit(data) self.do_quit(data)
@@ -45,7 +45,7 @@ class Quit(Command):
reason = " ".join(args) reason = " ".join(args)
else: else:
if not args or args[0].lower() != data.my_nick: 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 return
reason = " ".join(args[1:]) reason = " ".join(args[1:])




+ 2
- 2
earwigbot/commands/registration.py View File

@@ -42,7 +42,7 @@ class Registration(Command):
try: try:
reg = user.registration reg = user.registration
except exceptions.UserNotFoundError: 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)) self.reply(data, msg.format(name))
return return


@@ -54,7 +54,7 @@ class Registration(Command):
elif user.gender == "female": elif user.gender == "female":
gender = "She's" gender = "She's"
else: else:
gender = "They're" # Singluar they?
gender = "They're" # Singular they?


msg = "\x0302{0}\x0F registered on {1}. {2} {3} old." msg = "\x0302{0}\x0F registered on {1}. {2} {3} old."
self.reply(data, msg.format(name, date, gender, age)) self.reply(data, msg.format(name, date, gender, age))


+ 3
- 3
earwigbot/commands/remind.py View File

@@ -32,19 +32,19 @@ class Remind(Command):


def process(self, data): def process(self, data):
if not data.args: 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) self.reply(data, msg)
return return


try: try:
wait = int(data.args[0]) wait = int(data.args[0])
except ValueError: 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) self.reply(data, msg)
return return
message = ' '.join(data.args[1:]) message = ' '.join(data.args[1:])
if not message: 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) self.reply(data, msg)
return return




+ 2
- 2
earwigbot/commands/rights.py View File

@@ -40,7 +40,7 @@ class Rights(Command):
try: try:
rights = user.groups rights = user.groups
except exceptions.UserNotFoundError: 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)) self.reply(data, msg.format(name))
return return


@@ -48,5 +48,5 @@ class Rights(Command):
rights.remove("*") # Remove the '*' group given to everyone rights.remove("*") # Remove the '*' group given to everyone
except ValueError: except ValueError:
pass 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))) self.reply(data, msg.format(name, ', '.join(rights)))

+ 1
- 1
earwigbot/commands/test.py View File

@@ -34,4 +34,4 @@ class Test(Command):
if hey: if hey:
self.say(data.chan, "Hey {0}!".format(user)) self.say(data.chan, "Hey {0}!".format(user))
else: else:
self.say(data.chan, "'sup {0}?".format(user))
self.say(data.chan, "'Sup {0}?".format(user))

+ 6
- 6
earwigbot/commands/threads.py View File

@@ -33,7 +33,7 @@ class Threads(Command):
def process(self, data): def process(self, data):
self.data = data self.data = data
if data.host not in self.config.irc["permissions"]["owners"]: 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) self.reply(data, msg)
return return


@@ -41,7 +41,7 @@ class Threads(Command):
if data.command == "tasklist": if data.command == "tasklist":
self.do_list() self.do_list()
else: 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)) self.reply(data, msg.format(data.command))
return return


@@ -55,7 +55,7 @@ class Threads(Command):
self.do_listall() self.do_listall()


else: # They asked us to do something we don't know 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) self.reply(data, msg)


def do_list(self): def do_list(self):
@@ -128,16 +128,16 @@ class Threads(Command):
try: try:
task_name = data.args[1] task_name = data.args[1]
except IndexError: # No task name given 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 return


if task_name not in [task.name for task in self.bot.tasks]: if task_name not in [task.name for task in self.bot.tasks]:
# This task does not exist or hasn't been loaded: # 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)) self.reply(data, msg.format(task_name))
return return


data.kwargs["fromIRC"] = True data.kwargs["fromIRC"] = True
self.bot.tasks.start(task_name, **data.kwargs) 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) self.reply(data, msg)

+ 2
- 2
earwigbot/commands/time.py View File

@@ -56,13 +56,13 @@ class Time(Command):


def do_time(self, data, timezone): def do_time(self, data, timezone):
if not pytz: 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) self.reply(data, msg)
return return
try: try:
tzinfo = pytz.timezone(timezone) tzinfo = pytz.timezone(timezone)
except pytz.exceptions.UnknownTimeZoneError: except pytz.exceptions.UnknownTimeZoneError:
self.reply(data, "unknown timezone: {0}.".format(timezone))
self.reply(data, "Unknown timezone: {0}.".format(timezone))
return return
now = pytz.utc.localize(datetime.utcnow()).astimezone(tzinfo) now = pytz.utc.localize(datetime.utcnow()).astimezone(tzinfo)
self.reply(data, now.strftime("%Y-%m-%d %H:%M:%S %Z")) self.reply(data, now.strftime("%Y-%m-%d %H:%M:%S %Z"))

Loading…
Cancel
Save