mirror of
https://github.com/Noratrieb/widetom.git
synced 2026-01-14 17:05:03 +01:00
shutdown
This commit is contained in:
parent
85f9572c5b
commit
784b228e47
1 changed files with 16 additions and 8 deletions
24
src/main.rs
24
src/main.rs
|
|
@ -14,7 +14,7 @@ use serenity::model::id::UserId;
|
||||||
use serenity::utils::{content_safe, ContentSafeOptions};
|
use serenity::utils::{content_safe, ContentSafeOptions};
|
||||||
use uwuifier::uwuify_str_sse;
|
use uwuifier::uwuify_str_sse;
|
||||||
|
|
||||||
use widertom::normal_message;
|
use widertom::{normal_message, reply};
|
||||||
|
|
||||||
#[group]
|
#[group]
|
||||||
#[commands(say)]
|
#[commands(say)]
|
||||||
|
|
@ -26,6 +26,11 @@ struct General;
|
||||||
#[description = "meme commands"]
|
#[description = "meme commands"]
|
||||||
struct Meme;
|
struct Meme;
|
||||||
|
|
||||||
|
#[group]
|
||||||
|
#[commands(shutdown)]
|
||||||
|
#[owners_only]
|
||||||
|
#[description = "bot admin commands"]
|
||||||
|
struct Admin;
|
||||||
|
|
||||||
struct Handler;
|
struct Handler;
|
||||||
|
|
||||||
|
|
@ -39,7 +44,6 @@ impl EventHandler for Handler {
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
|
||||||
let token = fs::read_to_string("bot_token")
|
let token = fs::read_to_string("bot_token")
|
||||||
.expect("Expected bot token in file 'bot_token'");
|
.expect("Expected bot token in file 'bot_token'");
|
||||||
|
|
||||||
|
|
@ -48,11 +52,8 @@ async fn main() {
|
||||||
let (owners, bot_id) = match http.get_current_application_info().await {
|
let (owners, bot_id) = match http.get_current_application_info().await {
|
||||||
Ok(info) => {
|
Ok(info) => {
|
||||||
let mut owners = HashSet::new();
|
let mut owners = HashSet::new();
|
||||||
if let Some(team) = info.team {
|
owners.insert(UserId(414755070161453076)); //nils
|
||||||
owners.insert(team.owner_user_id);
|
owners.insert(UserId(265849018662387712)); //yuki
|
||||||
} else {
|
|
||||||
owners.insert(info.owner.id);
|
|
||||||
}
|
|
||||||
match http.get_current_user().await {
|
match http.get_current_user().await {
|
||||||
Ok(bot_id) => (owners, bot_id.id),
|
Ok(bot_id) => (owners, bot_id.id),
|
||||||
Err(why) => panic!("Could not access the bot id: {:?}", why),
|
Err(why) => panic!("Could not access the bot id: {:?}", why),
|
||||||
|
|
@ -72,7 +73,8 @@ async fn main() {
|
||||||
.normal_message(normal_message)
|
.normal_message(normal_message)
|
||||||
.help(&MY_HELP)
|
.help(&MY_HELP)
|
||||||
.group(&GENERAL_GROUP)
|
.group(&GENERAL_GROUP)
|
||||||
.group(&MEME_GROUP);
|
.group(&MEME_GROUP)
|
||||||
|
.group(&ADMIN_GROUP);
|
||||||
|
|
||||||
let mut client = Client::builder(&token)
|
let mut client = Client::builder(&token)
|
||||||
.event_handler(Handler)
|
.event_handler(Handler)
|
||||||
|
|
@ -109,6 +111,12 @@ async fn uwuify(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[command]
|
||||||
|
async fn shutdown(ctx: &Context, msg: &Message, _: Args) -> CommandResult {
|
||||||
|
reply("<:tom:811324632082415626> bye <:tom:811324632082415626>", &msg, &ctx).await;
|
||||||
|
std::process::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[help]
|
#[help]
|
||||||
#[individual_command_tip =
|
#[individual_command_tip =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue