help me
This commit is contained in:
parent
fcb227e316
commit
af46ea6386
@ -1,79 +1,3 @@
|
||||
{
|
||||
"channels": [
|
||||
{
|
||||
"id": "1030714032900030466",
|
||||
"bitrate": null,
|
||||
"parent_id": "1030714032900030464",
|
||||
"guild_id": "1030714031880818729",
|
||||
"type": 0,
|
||||
"owner_id": null,
|
||||
"last_message_id": "1232079362921332746",
|
||||
"last_pin_timestamp": null,
|
||||
"name": "general",
|
||||
"permission_overwrites": [
|
||||
{
|
||||
"allow": "49152",
|
||||
"deny": "0",
|
||||
"id": "1030714031880818729",
|
||||
"type": 0
|
||||
}
|
||||
],
|
||||
"position": 0,
|
||||
"topic": null,
|
||||
"user_limit": null,
|
||||
"nsfw": false,
|
||||
"rate_limit_per_user": 0,
|
||||
"rtc_region": null,
|
||||
"video_quality_mode": null,
|
||||
"message_count": null,
|
||||
"member_count": null,
|
||||
"thread_metadata": null,
|
||||
"member": null,
|
||||
"default_auto_archive_duration": null,
|
||||
"permissions": null,
|
||||
"flags": 0,
|
||||
"total_message_sent": null,
|
||||
"available_tags": [],
|
||||
"applied_tags": [],
|
||||
"default_reaction_emoji": null,
|
||||
"default_thread_rate_limit_per_user": null,
|
||||
"status": null,
|
||||
"default_sort_order": null,
|
||||
"default_forum_layout": null
|
||||
},
|
||||
{
|
||||
"id": "1232064459737010247",
|
||||
"bitrate": null,
|
||||
"parent_id": "1030714032900030464",
|
||||
"guild_id": "1030714031880818729",
|
||||
"type": 0,
|
||||
"owner_id": null,
|
||||
"last_message_id": null,
|
||||
"last_pin_timestamp": null,
|
||||
"name": "asdf",
|
||||
"permission_overwrites": [],
|
||||
"position": 2,
|
||||
"topic": null,
|
||||
"user_limit": null,
|
||||
"nsfw": false,
|
||||
"rate_limit_per_user": 0,
|
||||
"rtc_region": null,
|
||||
"video_quality_mode": null,
|
||||
"message_count": null,
|
||||
"member_count": null,
|
||||
"thread_metadata": null,
|
||||
"member": null,
|
||||
"default_auto_archive_duration": null,
|
||||
"permissions": null,
|
||||
"flags": 0,
|
||||
"total_message_sent": null,
|
||||
"available_tags": [],
|
||||
"applied_tags": [],
|
||||
"default_reaction_emoji": null,
|
||||
"default_thread_rate_limit_per_user": null,
|
||||
"status": null,
|
||||
"default_sort_order": null,
|
||||
"default_forum_layout": null
|
||||
}
|
||||
]
|
||||
"channels": []
|
||||
}
|
@ -1,11 +1,24 @@
|
||||
use crate::Context;
|
||||
use crate::Error;
|
||||
|
||||
/// Shut down the bot remotely
|
||||
#[poise::command(slash_command, owners_only, hide_in_help)]
|
||||
pub async fn shutdown(ctx: Context<'_>) -> Result<(), Error> {
|
||||
ctx.defer_ephemeral().await?;
|
||||
ctx.say("Shutting down...").await?;
|
||||
info!("Received `shutdown` command, shutting down all shards");
|
||||
ctx.framework().shard_manager().shutdown_all().await;
|
||||
info!("Executed command `shutdown` successfully");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Restart the bot remotely
|
||||
#[poise::command(slash_command, owners_only, hide_in_help)]
|
||||
pub async fn restart(ctx: Context<'_>) -> Result<(), Error> {
|
||||
ctx.defer_ephemeral().await?;
|
||||
ctx.say("Restarting...").await?;
|
||||
for shard in ctx.framework().shard_manager().shards_instantiated().await {
|
||||
ctx.framework().shard_manager().restart(shard).await;
|
||||
}
|
||||
info!("Executed command `restart` successfully");
|
||||
Ok(())
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ async fn main() {
|
||||
// +---------------------------------------------------------+
|
||||
// | ADD COMMANDS HERE |
|
||||
// +---------------------------------------------------------+
|
||||
commands: vec![age(), info(), add_channel(), list_channels(), shutdown()],
|
||||
commands: vec![age(), info(), add_channel(), list_channels(), shutdown(), restart()],
|
||||
initialize_owners: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -112,4 +112,5 @@ async fn main() {
|
||||
// Finally start everything. Nothing after this should be reachable normally.
|
||||
info!("Starting client");
|
||||
client.start().await.unwrap();
|
||||
info!("All tasks finished, shutting down");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user