Browse Source

!status nocolor for HallowsAG

tags/v0.1^2
Ben Kurtovic 13 years ago
parent
commit
3e5801d5e6
2 changed files with 10 additions and 4 deletions
  1. +9
    -3
      bot/commands/afc_status.py
  2. +1
    -1
      bot/tasks/afc_statistics.py

+ 9
- 3
bot/commands/afc_status.py View File

@@ -66,21 +66,27 @@ class Command(BaseCommand):
msg = "aggregate is \x0305{0}\x0301 (AfC {1})." msg = "aggregate is \x0305{0}\x0301 (AfC {1})."
self.connection.reply(data, msg.format(agg_num, aggregate)) self.connection.reply(data, msg.format(agg_num, aggregate))


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

else: else:
msg = "unknown argument: \x0303{0}\x0301. Valid args are 'subs', 'redirs', 'files', 'agg'."
msg = "unknown argument: \x0303{0}\x0301. Valid args are 'subs', 'redirs', 'files', 'agg', 'nocolor'."
self.connection.reply(data, msg.format(data.args[0])) self.connection.reply(data, msg.format(data.args[0]))


else: else:
self.connection.reply(data, self.get_status()) self.connection.reply(data, self.get_status())


def get_status(self):
def get_status(self, color=True):
subs = self.count_submissions() subs = self.count_submissions()
redirs = self.count_redirects() redirs = self.count_redirects()
files = self.count_files() files = self.count_files()
agg_num = self.get_aggregate_number((subs, redirs, files)) agg_num = self.get_aggregate_number((subs, redirs, files))
aggregate = self.get_aggregate(agg_num) aggregate = self.get_aggregate(agg_num)


msg = "Articles for creation {0} (\x0302AFC\x0301: \x0305{1}\x0301; \x0302AFC/R\x0301: \x0305{2}\x0301; \x0302FFU\x0301: \x0305{3}\x0301)."
if color:
msg = "Articles for creation {0} (\x0302AFC\x0301: \x0305{1}\x0301; \x0302AFC/R\x0301: \x0305{2}\x0301; \x0302FFU\x0301: \x0305{3}\x0301)."
else:
msg = "Articles for creation {0} (AFC: {1}; AFC/R: {2}; FFU: {3})."
return msg.format(aggregate, subs, redirs, files) return msg.format(aggregate, subs, redirs, files)


def count_submissions(self): def count_submissions(self):


+ 1
- 1
bot/tasks/afc_statistics.py View File

@@ -292,7 +292,7 @@ class Task(BaseTask):
"""Update hook for when page is not in our database. """Update hook for when page is not in our database.


A variety of SQL queries are used to gather information about the page, A variety of SQL queries are used to gather information about the page,
which are then saved to our database.
which is then saved to our database.
""" """
content = self.get_content(title) content = self.get_content(title)
if content is None: if content is None:


Loading…
Cancel
Save