1mod attachment_parameter;
2mod autocomplete;
3mod bool_parameter;
4mod builtins;
5mod checks;
6mod choice_parameter;
7mod code_block_parameter;
8mod collector;
9mod context_menu;
10mod inherit_checks;
11mod localization;
12mod modal;
13mod paginate;
14mod panic_handler;
15mod parameter_attributes;
16mod raw_identifiers;
17mod response_with_reply;
18mod subcommand_required;
19mod subcommands;
20mod track_edits;
21mod user_apps;
22
23use poise::serenity_prelude as serenity;
24
25type Error = Box<dyn std::error::Error + Send + Sync>;
26type Context<'a> = poise::Context<'a, Data, Error>;
27pub struct Data {}
29
30#[tokio::main]
31async fn main() {
32 tracing_subscriber::fmt::init();
33
34 let framework = poise::Framework::builder()
35 .options(poise::FrameworkOptions {
36 commands: vec![
37 attachment_parameter::file_details(),
38 attachment_parameter::totalsize(),
39 autocomplete::greet(),
40 bool_parameter::oracle(),
41 #[cfg(feature = "cache")]
42 builtins::servers(),
43 checks::shutdown(),
44 checks::modonly(),
45 checks::delete(),
46 checks::ferrisparty(),
47 checks::cooldowns(),
48 checks::minmax(),
49 checks::get_guild_name(),
50 checks::only_in_dms(),
51 checks::lennyface(),
52 checks::permissions_v2(),
53 choice_parameter::choice(),
54 choice_parameter::inline_choice(),
55 choice_parameter::inline_choice_int(),
56 code_block_parameter::code(),
57 collector::boop(),
58 context_menu::user_info(),
59 context_menu::echo(),
60 inherit_checks::parent_checks(),
61 localization::welcome(),
62 modal::modal(),
63 modal::component_modal(),
64 paginate::paginate(),
65 panic_handler::div(),
66 parameter_attributes::addmultiple(),
67 parameter_attributes::voiceinfo(),
68 parameter_attributes::say(),
69 parameter_attributes::punish(),
70 parameter_attributes::stringlen(),
71 raw_identifiers::r#move(),
72 response_with_reply::reply(),
73 subcommands::parent(),
74 subcommand_required::parent_subcommand_required(),
75 track_edits::test_reuse_response(),
76 track_edits::add(),
77 user_apps::everywhere(),
78 user_apps::everywhere_context(),
79 user_apps::user_install(),
80 user_apps::not_in_guilds(),
81 user_apps::user_install_guild(),
82 ],
83 prefix_options: poise::PrefixFrameworkOptions {
84 prefix: Some("~".into()),
85 non_command_message: Some(|_, msg| {
86 Box::pin(async move {
87 println!("non command message!: {}", msg.content);
88 Ok(())
89 })
90 }),
91 ..Default::default()
92 },
93 on_error: |error| {
94 Box::pin(async move {
95 println!("what the hell");
96 match error {
97 poise::FrameworkError::ArgumentParse { error, .. } => {
98 if let Some(error) = error.downcast_ref::<serenity::RoleParseError>() {
99 println!("Found a RoleParseError: {:?}", error);
100 } else {
101 println!("Not a RoleParseError :(");
102 }
103 }
104 other => poise::builtins::on_error(other).await.unwrap(),
105 }
106 })
107 },
108 ..Default::default()
109 })
110 .setup(move |ctx, _ready, framework| {
111 Box::pin(async move {
112 poise::builtins::register_globally(ctx, &framework.options().commands).await?;
113 Ok(Data {})
114 })
115 })
116 .build();
117
118 let token = std::env::var("DISCORD_TOKEN").unwrap();
119 let intents =
120 serenity::GatewayIntents::non_privileged() | serenity::GatewayIntents::MESSAGE_CONTENT;
121
122 let client = serenity::ClientBuilder::new(token, intents)
123 .framework(framework)
124 .await;
125
126 client.unwrap().start().await.unwrap()
127}