-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from esoviscode/staging
Release v0.1.3
- Loading branch information
Showing
28 changed files
with
877 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from nextcord.ext import commands | ||
from nextcord.ext.commands import Cog, Bot | ||
from nextcord import slash_command | ||
|
||
from dnd_bot.logic.prototype.multiverse import Multiverse | ||
|
||
|
||
class ShutdownCommand(Cog): | ||
"""Handles shutting down the bot with all its threads""" | ||
def __init__(self, bot: Bot): | ||
self.bot = bot | ||
|
||
@slash_command(name="shutdown", description="Shutdowns bot") | ||
async def shutdown(self, interaction): | ||
caller_id = interaction.user.id | ||
# only these users can shut down the bot | ||
if caller_id == 349553403229110274 \ | ||
or caller_id == 211188033968406530 \ | ||
or caller_id == 444538116569825290 \ | ||
or caller_id == 602785249025589259 \ | ||
or caller_id == 544262699907809309: | ||
await interaction.response.send_message("Shutting down... :coffin:") | ||
|
||
# stop all running game threads | ||
for game in Multiverse.games.values(): | ||
game.game_state = "INACTIVE" | ||
game.get_active_player().active = False | ||
game.game_loop_thread.join() | ||
|
||
await self.bot.close() | ||
else: | ||
await interaction.response.send_message("You have no permission to shutdown me :man_gesturing_no:!") | ||
|
||
|
||
def setup(bot): | ||
bot.add_cog(ShutdownCommand(bot)) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.