[V3 Core] add restart command (#1272)

This commit is contained in:
palmtree5 2018-01-28 18:29:56 -09:00 committed by Kowlin
parent 1d1f2c9f12
commit f36ed2f8c8
2 changed files with 123 additions and 52 deletions

View File

@ -277,6 +277,21 @@ class Core:
except: except:
pass pass
await ctx.bot.shutdown() await ctx.bot.shutdown()
@commands.command(name="restart")
@checks.is_owner()
async def _restart(self, ctx, silently: bool=False):
"""Attempts to restart Red
Makes Red quit with exit code 26
The restart is not guaranteed: it must be dealt
with by the process manager in use"""
try:
if not silently:
await ctx.send(_("Restarting..."))
except:
pass
await ctx.bot.shutdown(restart=True)
def cleanup_and_refresh_modules(self, module_name: str): def cleanup_and_refresh_modules(self, module_name: str):
"""Interally reloads modules so that changes are detected""" """Interally reloads modules so that changes are detected"""

View File

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2017-08-26 18:11+EDT\n" "POT-Creation-Date: 2018-01-28 15:46+AKST\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -15,209 +15,265 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
#: ../cog_manager.py:196 #: ../cog_manager.py:308
msgid "" msgid ""
"Install Path: {}\n" "Install Path: {}\n"
"\n" "\n"
msgstr "" msgstr ""
#: ../cog_manager.py:212 #: ../cog_manager.py:324
msgid "That path is does not exist or does not point to a valid directory." msgid "That path is does not exist or does not point to a valid directory."
msgstr "" msgstr ""
#: ../cog_manager.py:221 #: ../cog_manager.py:333
msgid "Path successfully added." msgid "Path successfully added."
msgstr "" msgstr ""
#: ../cog_manager.py:234 #: ../cog_manager.py:346
msgid "That is an invalid path number." msgid "That is an invalid path number."
msgstr "" msgstr ""
#: ../cog_manager.py:238 #: ../cog_manager.py:350
msgid "Path successfully removed." msgid "Path successfully removed."
msgstr "" msgstr ""
#: ../cog_manager.py:254 #: ../cog_manager.py:366
msgid "Invalid 'from' index." msgid "Invalid 'from' index."
msgstr "" msgstr ""
#: ../cog_manager.py:260 #: ../cog_manager.py:372
msgid "Invalid 'to' index." msgid "Invalid 'to' index."
msgstr "" msgstr ""
#: ../cog_manager.py:264 #: ../cog_manager.py:376
msgid "Paths reordered." msgid "Paths reordered."
msgstr "" msgstr ""
#: ../cog_manager.py:282 #: ../cog_manager.py:394
msgid "That path does not exist." msgid "That path does not exist."
msgstr "" msgstr ""
#: ../cog_manager.py:286 #: ../cog_manager.py:398
msgid "The bot will install new cogs to the `{}` directory." msgid "The bot will install new cogs to the `{}` directory."
msgstr "" msgstr ""
#: ../core_commands.py:35 #: ../core_commands.py:189 ../core_commands.py:223
msgid "No module by that name was found in any cog path." msgid "No module by that name was found in any cog path."
msgstr "" msgstr ""
#: ../core_commands.py:43 #: ../core_commands.py:197
msgid "Failed to load package. Check your console or logs for details." msgid "Failed to load package. Check your console or logs for details."
msgstr "" msgstr ""
#: ../core_commands.py:47 ../core_commands.py:56 ../core_commands.py:76 #: ../core_commands.py:201 ../core_commands.py:210 ../core_commands.py:235
#: ../core_commands.py:151 ../core_commands.py:212 ../core_commands.py:226 #: ../core_commands.py:324 ../core_commands.py:388 ../core_commands.py:402
msgid "Done." msgid "Done."
msgstr "" msgstr ""
#: ../core_commands.py:58 #: ../core_commands.py:212
msgid "That extension is not loaded." msgid "That extension is not loaded."
msgstr "" msgstr ""
#: ../core_commands.py:71 #: ../core_commands.py:232
msgid "Failed to reload package. Check your console or logs for details." msgid "Failed to reload package. Check your console or logs for details."
msgstr "" msgstr ""
#: ../core_commands.py:86 #: ../core_commands.py:245
msgid "Shutting down... " msgid "Shutting down... "
msgstr "" msgstr ""
#: ../core_commands.py:123 #: ../core_commands.py:260
msgid "Restarting..."
msgstr ""
#: ../core_commands.py:297
msgid "The admin role for this guild has been set." msgid "The admin role for this guild has been set."
msgstr "" msgstr ""
#: ../core_commands.py:131 #: ../core_commands.py:305
msgid "The mod role for this guild has been set." msgid "The mod role for this guild has been set."
msgstr "" msgstr ""
#: ../core_commands.py:145 #: ../core_commands.py:318
msgid "Failed. Remember that you can edit my avatar up to two times a hour. The URL must be a direct link to a JPG / PNG." msgid "Failed. Remember that you can edit my avatar up to two times a hour. The URL must be a direct link to a JPG / PNG."
msgstr "" msgstr ""
#: ../core_commands.py:149 #: ../core_commands.py:322
msgid "JPG / PNG format only." msgid "JPG / PNG format only."
msgstr "" msgstr ""
#: ../core_commands.py:161 #: ../core_commands.py:337
msgid "Game set." msgid "Game set."
msgstr "" msgstr ""
#: ../core_commands.py:190 #: ../core_commands.py:366
msgid "Status changed to %s." msgid "Status changed to %s."
msgstr "" msgstr ""
#: ../core_commands.py:221 #: ../core_commands.py:397
msgid "Failed to change name. Remember that you can only do it up to 2 times an hour. Use nicknames if you need frequent changes. `{}set nickname`" msgid "Failed to change name. Remember that you can only do it up to 2 times an hour. Use nicknames if you need frequent changes. `{}set nickname`"
msgstr "" msgstr ""
#: ../core_commands.py:236 #: ../core_commands.py:412
msgid "I lack the permissions to change my own nickname." msgid "I lack the permissions to change my own nickname."
msgstr "" msgstr ""
#: ../core_commands.py:250 ../core_commands.py:263 #: ../core_commands.py:426 ../core_commands.py:439
msgid "Prefix set." msgid "Prefix set."
msgstr "" msgstr ""
#: ../core_commands.py:259 #: ../core_commands.py:435
msgid "Guild prefixes have been reset." msgid "Guild prefixes have been reset."
msgstr "" msgstr ""
#: ../core_commands.py:282 #: ../core_commands.py:458
msgid "" msgid ""
"\n" "\n"
"Verification token:" "Verification token:"
msgstr "" msgstr ""
#: ../core_commands.py:285 #: ../core_commands.py:461
msgid "" msgid ""
"Remember:\n" "Remember:\n"
msgstr "" msgstr ""
#: ../core_commands.py:288 #: ../core_commands.py:464
msgid "I have printed a one-time token in the console. Copy and paste it here to confirm you are the owner." msgid "I have printed a one-time token in the console. Copy and paste it here to confirm you are the owner."
msgstr "" msgstr ""
#: ../core_commands.py:296 #: ../core_commands.py:472
msgid "The set owner request has timed out." msgid "The set owner request has timed out."
msgstr "" msgstr ""
#: ../core_commands.py:302 #: ../core_commands.py:478
msgid "You have been set as owner." msgid "You have been set as owner."
msgstr "" msgstr ""
#: ../core_commands.py:304 #: ../core_commands.py:480
msgid "Invalid token." msgid "Invalid token."
msgstr "" msgstr ""
#: ../core_commands.py:313 #: ../core_commands.py:492
msgid "Locale has been set." msgid "Locale has been set."
msgstr "" msgstr ""
#: ../core_commands.py:323 #: ../core_commands.py:506
msgid "Done. Sentry logging is now enabled."
msgstr ""
#: ../core_commands.py:509
msgid "Done. Sentry logging is now disabled."
msgstr ""
#: ../core_commands.py:519
msgid "User ID: %s" msgid "User ID: %s"
msgstr "" msgstr ""
#: ../core_commands.py:326 #: ../core_commands.py:522
msgid "through DM" msgid "through DM"
msgstr "" msgstr ""
#: ../core_commands.py:328 #: ../core_commands.py:524
msgid "from {}" msgid "from {}"
msgstr "" msgstr ""
#: ../core_commands.py:329 #: ../core_commands.py:525
msgid " | Server ID: %s" msgid " | Server ID: %s"
msgstr "" msgstr ""
#: ../core_commands.py:337 #: ../core_commands.py:534
msgid "Use `{}dm {} <text>` to reply to this user" msgid "Use `{}dm {} <text>` to reply to this user"
msgstr "" msgstr ""
#: ../core_commands.py:345 #: ../core_commands.py:542
msgid "Sent by {} {}" msgid "Sent by {} {}"
msgstr "" msgstr ""
#: ../core_commands.py:357 #: ../core_commands.py:554
msgid "I cannot send your message, I'm unable to find my owner... *sigh*" msgid "I cannot send your message, I'm unable to find my owner... *sigh*"
msgstr "" msgstr ""
#: ../core_commands.py:360 #: ../core_commands.py:557
msgid "I'm unable to deliver your message. Sorry." msgid "I'm unable to deliver your message. Sorry."
msgstr "" msgstr ""
#: ../core_commands.py:362 #: ../core_commands.py:559
msgid "Your message has been sent." msgid "Your message has been sent."
msgstr "" msgstr ""
#: ../core_commands.py:376 #: ../core_commands.py:573
msgid "Invalid ID or user not found. You can only send messages to people I share a server with." msgid "Invalid ID or user not found. You can only send messages to people I share a server with."
msgstr "" msgstr ""
#: ../core_commands.py:382 #: ../core_commands.py:579
msgid "Owner of %s" msgid "Owner of %s"
msgstr "" msgstr ""
#: ../core_commands.py:385 #: ../core_commands.py:583
msgid "You can reply to this message with %scontact" msgid "You can reply to this message with %scontact"
msgstr "" msgstr ""
#: ../core_commands.py:395 #: ../core_commands.py:593
msgid "Sorry, I couldn't deliver your message to %s" msgid "Sorry, I couldn't deliver your message to %s"
msgstr "" msgstr ""
#: ../core_commands.py:398 #: ../core_commands.py:596
msgid "Message delivered to %s" msgid "Message delivered to %s"
msgstr "" msgstr ""
#: ../dev_commands.py:165 #: ../core_commands.py:616
msgid "User added to whitelist."
msgstr ""
#: ../core_commands.py:625
msgid "Whitelisted Users:"
msgstr ""
#: ../core_commands.py:645
msgid "User has been removed from whitelist."
msgstr ""
#: ../core_commands.py:647
msgid "User was not in the whitelist."
msgstr ""
#: ../core_commands.py:655
msgid "Whitelist has been cleared."
msgstr ""
#: ../core_commands.py:672
msgid "You cannot blacklist an owner!"
msgstr ""
#: ../core_commands.py:679
msgid "User added to blacklist."
msgstr ""
#: ../core_commands.py:688
msgid "blacklisted Users:"
msgstr ""
#: ../core_commands.py:708
msgid "User has been removed from blacklist."
msgstr ""
#: ../core_commands.py:710
msgid "User was not in the blacklist."
msgstr ""
#: ../core_commands.py:718
msgid "blacklist has been cleared."
msgstr ""
#: ../dev_commands.py:213
msgid "Already running a REPL session in this channel. Exit it with `quit`." msgid "Already running a REPL session in this channel. Exit it with `quit`."
msgstr "" msgstr ""
#: ../dev_commands.py:169 #: ../dev_commands.py:218
msgid "Enter code to execute or evaluate. `exit()` or `quit` to exit." msgid "Enter code to execute or evaluate. `exit()` or `quit` to exit."
msgstr "" msgstr ""
#: ../dev_commands.py:234 #: ../dev_commands.py:281
msgid "Unexpected error: `{}`" msgid "Unexpected error: `{}`"
msgstr "" msgstr ""