|
20 | 20 | from subscriptions import Subscriptions |
21 | 21 | from team_expando import TeamExpander |
22 | 22 | from tower_data import TowerOfDoomData |
23 | | -from translations import LANGUAGES |
| 23 | +from translations import LANGUAGES, LANGUAGE_CODE_MAPPING |
24 | 24 | from util import bool_to_emoticon, chunks, pluralize_author |
25 | 25 | from views import Views |
26 | 26 |
|
@@ -288,21 +288,18 @@ async def show_spoilers(self, message, prefix, lang, filter): |
288 | 288 |
|
289 | 289 | async def show_uptime(self, message, prefix, lang): |
290 | 290 | e = discord.Embed(title='Uptime', color=self.WHITE) |
291 | | - if lang == 'cn': |
292 | | - lang = 'zh' |
| 291 | + lang = LANGUAGE_CODE_MAPPING.get(lang, lang) |
| 292 | + bot_offline = datetime.timedelta(seconds=self.downtimes) |
293 | 293 | if lang != 'en': |
294 | 294 | _t = humanize.i18n.activate(lang) |
295 | | - now = datetime.datetime.now() |
296 | | - bot_uptime = now - self.bot_start |
297 | | - bot_offline = datetime.timedelta(seconds=self.downtimes) |
298 | | - uptime = f'{humanize.naturaltime(self.bot_start)} ({humanize.naturaldelta(bot_uptime)})' |
| 295 | + uptime = f'{humanize.naturaltime(self.bot_start)}' |
299 | 296 | e.add_field(name='Bot running since', value=uptime, inline=False) |
300 | 297 | if bot_offline: |
301 | 298 | e.add_field(name='Offline for', value=humanize.naturaldelta(bot_offline), inline=False) |
| 299 | + humanize.i18n.deactivate() |
302 | 300 | bot_runtime = (datetime.datetime.now() - self.bot_start).seconds |
303 | 301 | availability = (bot_runtime - self.downtimes) / bot_runtime |
304 | 302 | e.add_field(name='Availability', value=f'{availability:.3%}') |
305 | | - humanize.i18n.deactivate() |
306 | 303 | await self.answer(message, e) |
307 | 304 |
|
308 | 305 | async def show_events(self, message, prefix, lang): |
|
0 commit comments