set poise version to git
This commit is contained in:
parent
03de111842
commit
b97e70bfe0
10 changed files with 152 additions and 203 deletions
163
Cargo.lock
generated
163
Cargo.lock
generated
|
@ -59,61 +59,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstream"
|
|
||||||
version = "0.6.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
|
|
||||||
dependencies = [
|
|
||||||
"anstyle",
|
|
||||||
"anstyle-parse",
|
|
||||||
"anstyle-query",
|
|
||||||
"anstyle-wincon",
|
|
||||||
"colorchoice",
|
|
||||||
"is_terminal_polyfill",
|
|
||||||
"utf8parse",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle"
|
|
||||||
version = "1.0.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-parse"
|
|
||||||
version = "0.2.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
|
|
||||||
dependencies = [
|
|
||||||
"utf8parse",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-query"
|
|
||||||
version = "1.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
|
|
||||||
dependencies = [
|
|
||||||
"windows-sys 0.52.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-wincon"
|
|
||||||
version = "3.0.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
|
|
||||||
dependencies = [
|
|
||||||
"anstyle",
|
|
||||||
"windows-sys 0.52.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anyhow"
|
|
||||||
version = "1.0.93"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
version = "0.7.6"
|
version = "0.7.6"
|
||||||
|
@ -296,10 +241,15 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colorchoice"
|
name = "command_attr"
|
||||||
version = "1.0.2"
|
version = "0.5.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
|
checksum = "6fcc89439e1bb4e19050a9586a767781a3060000d2f3296fd2a40597ad9421c5"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 1.0.109",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "concurrent-queue"
|
name = "concurrent-queue"
|
||||||
|
@ -522,29 +472,6 @@ dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "env_filter"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab"
|
|
||||||
dependencies = [
|
|
||||||
"log",
|
|
||||||
"regex",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "env_logger"
|
|
||||||
version = "0.11.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d"
|
|
||||||
dependencies = [
|
|
||||||
"anstream",
|
|
||||||
"anstyle",
|
|
||||||
"env_filter",
|
|
||||||
"humantime",
|
|
||||||
"log",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "equivalent"
|
name = "equivalent"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
@ -966,12 +893,6 @@ version = "1.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "humantime"
|
|
||||||
version = "2.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper"
|
name = "hyper"
|
||||||
version = "0.14.30"
|
version = "0.14.30"
|
||||||
|
@ -1137,12 +1058,6 @@ version = "2.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708"
|
checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "is_terminal_polyfill"
|
|
||||||
version = "1.70.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.11"
|
version = "1.0.11"
|
||||||
|
@ -1167,6 +1082,12 @@ dependencies = [
|
||||||
"spin",
|
"spin",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "levenshtein"
|
||||||
|
version = "1.0.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.159"
|
version = "0.2.159"
|
||||||
|
@ -1517,25 +1438,25 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "poise"
|
name = "poise"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/serenity-rs/poise#22b5b01ba54f7eb74f8fd2f3d52032fd7ef2dc01"
|
||||||
checksum = "1819d5a45e3590ef33754abce46432570c54a120798bdbf893112b4211fa09a6"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"derivative",
|
"derivative",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
"indexmap",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"poise_macros",
|
"poise_macros",
|
||||||
"regex",
|
"regex",
|
||||||
"serenity",
|
"serenity",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
"trim-in-place",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "poise_macros"
|
name = "poise_macros"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/serenity-rs/poise#22b5b01ba54f7eb74f8fd2f3d52032fd7ef2dc01"
|
||||||
checksum = "8fa2c123c961e78315cd3deac7663177f12be4460f5440dbf62a7ed37b1effea"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -1701,9 +1622,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reqwest"
|
name = "reqwest"
|
||||||
version = "0.12.8"
|
version = "0.12.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b"
|
checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -1964,9 +1885,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.214"
|
version = "1.0.215"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5"
|
checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
@ -1982,9 +1903,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.214"
|
version = "1.0.215"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766"
|
checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -1993,9 +1914,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.132"
|
version = "1.0.133"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03"
|
checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"memchr",
|
"memchr",
|
||||||
|
@ -2017,9 +1938,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serenity"
|
name = "serenity"
|
||||||
version = "0.12.2"
|
version = "0.12.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "880a04106592d0a8f5bdacb1d935889bfbccb4a14f7074984d9cd857235d34ac"
|
checksum = "3d72ec4323681bf9a3cabe40fd080abc2435859b502a1b5aa9bf693f125bfa76"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
@ -2027,10 +1948,12 @@ dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
"command_attr",
|
||||||
"dashmap",
|
"dashmap",
|
||||||
"flate2",
|
"flate2",
|
||||||
"futures",
|
"futures",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
|
"levenshtein",
|
||||||
"mime_guess",
|
"mime_guess",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
|
@ -2039,6 +1962,7 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_cow",
|
"serde_cow",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"static_assertions",
|
||||||
"time",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite",
|
||||||
|
@ -2046,6 +1970,7 @@ dependencies = [
|
||||||
"typemap_rev",
|
"typemap_rev",
|
||||||
"typesize",
|
"typesize",
|
||||||
"url",
|
"url",
|
||||||
|
"uwl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2352,6 +2277,12 @@ dependencies = [
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "static_assertions"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stringprep"
|
name = "stringprep"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
|
@ -2686,6 +2617,12 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "trim-in-place"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "343e926fc669bc8cde4fa3129ab681c63671bae288b1f1081ceee6d9d37904fc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "triomphe"
|
name = "triomphe"
|
||||||
version = "0.1.14"
|
version = "0.1.14"
|
||||||
|
@ -2827,10 +2764,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf8parse"
|
name = "uwl"
|
||||||
version = "0.2.2"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
checksum = "f4bf03e0ca70d626ecc4ba6b0763b934b6f2976e8c744088bb3c1d646fbb1ad0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcpkg"
|
name = "vcpkg"
|
||||||
|
@ -3227,13 +3164,9 @@ checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
|
||||||
name = "zmp-bot"
|
name = "zmp-bot"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
|
||||||
"env_logger",
|
|
||||||
"poise",
|
"poise",
|
||||||
"regex",
|
"reqwest 0.12.9",
|
||||||
"reqwest 0.12.8",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
|
||||||
"serenity",
|
"serenity",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|
19
Cargo.toml
19
Cargo.toml
|
@ -6,14 +6,11 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
poise = "0.6.1"
|
poise = { git = "https://github.com/serenity-rs/poise" }
|
||||||
serenity = { version = "0.12.1", default-features = false, features = ["client", "gateway", "model", "rustls_backend", "utils", "framework"] }
|
serenity = { version = "0.12.4" }
|
||||||
tokio = { version = "1.41.1", features = ["macros", "rt-multi-thread", "rt"] }
|
serde = { version = "1.0.215", features = ["derive"] }
|
||||||
env_logger = "0.11.3"
|
reqwest = { version = "0.12.9", features = ["json"] }
|
||||||
anyhow = "1.0.93"
|
tokio = { version = "1.41.1", features = ["rt-multi-thread"] }
|
||||||
tracing = "0.1.40"
|
|
||||||
regex = "1.11.1"
|
tracing = { version = "0.1.40" }
|
||||||
sqlx = { version = "0.8.2", features = ["sqlite", "sqlx-sqlite", "runtime-tokio"]}
|
sqlx = { version = "0.8.2", features = ["sqlite", "sqlx-sqlite", "runtime-tokio"]}
|
||||||
reqwest = { version = "0.12.5" }
|
|
||||||
serde = { version = "1.0.214", features = ["derive"] }
|
|
||||||
serde_json = { version = "1.0.132" }
|
|
|
@ -3,9 +3,8 @@ use reqwest::{Client, Response};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serenity::{
|
use serenity::{
|
||||||
all::{ChannelId, CreateActionRow, CreateAllowedMentions, CreateButton, CreateMessage, ReactionType, User},
|
all::{ChannelId, CreateActionRow, CreateAllowedMentions, CreateButton, CreateMessage, ReactionType, User},
|
||||||
json::JsonError,
|
|
||||||
};
|
};
|
||||||
use serenity::all::{ButtonStyle, Message};
|
use serenity::all::{ButtonStyle};
|
||||||
use sqlx::{Pool, query_as, Sqlite};
|
use sqlx::{Pool, query_as, Sqlite};
|
||||||
|
|
||||||
use crate::commands::command_helper::cooldown;
|
use crate::commands::command_helper::cooldown;
|
||||||
|
@ -45,34 +44,21 @@ impl Uuid {
|
||||||
fn get(&self) -> &str {
|
fn get(&self) -> &str {
|
||||||
self.uuid.as_str()
|
self.uuid.as_str()
|
||||||
}
|
}
|
||||||
async fn fetch(ign: &str) -> Result<Self, Error> {
|
async fn for_ign(ign: &str) -> Result<Self, Error> {
|
||||||
let url: String = format!("https://api.mojang.com/users/profiles/minecraft/{ign}");
|
let url: String = format!("https://api.mojang.com/users/profiles/minecraft/{ign}");
|
||||||
let response: Response = reqwest::get(url).await?;
|
let response_400: Response = reqwest::get(url).await?.error_for_status()?;
|
||||||
let response_text = response.error_for_status()?.text().await.unwrap();
|
let deserialized = response_400.json::<MojangPlayer>().await?;
|
||||||
let uuid = (serde_json::from_str(response_text.as_str()) as Result<MojangPlayer, JsonError>)
|
let uuid = Uuid {
|
||||||
.map(|mojang_player: MojangPlayer| Uuid { uuid: mojang_player.id })?;
|
uuid: deserialized.id,
|
||||||
|
};
|
||||||
Ok(uuid)
|
Ok(uuid)
|
||||||
/*match response.error_for_status() {
|
|
||||||
Ok(res) => {
|
|
||||||
let response_text = res.text().await.unwrap();
|
|
||||||
let uuid = (serde_json::from_str(response_text.as_str())
|
|
||||||
as Result<MojangPlayer, JsonError>)
|
|
||||||
.map(|mojang_player: MojangPlayer| Uuid { uuid: mojang_player.id })?;
|
|
||||||
Ok(uuid)
|
|
||||||
}
|
|
||||||
Err(why) => Err(Error::from(format!(
|
|
||||||
"Mojang returned an error. Please make sure to enter a valid Minecraft username.\n\n\
|
|
||||||
Details: {}", why).as_str())),
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn ign(&self) -> Result<String, Error> {
|
async fn ign(&self) -> Result<String, Error> {
|
||||||
let url: String = format!("https://sessionserver.mojang.com/session/minecraft/profile/{}", self.uuid);
|
let url: String = format!("https://sessionserver.mojang.com/session/minecraft/profile/{}", self.uuid);
|
||||||
let response: Response = reqwest::get(url).await?;
|
let response_400: Response = reqwest::get(url).await?.error_for_status()?;
|
||||||
let response_text = response.error_for_status()?.text().await.unwrap();
|
let deserialized = response_400.json::<MojangPlayer>().await?;
|
||||||
let ign = (serde_json::from_str(response_text.as_str()) as Result<MojangPlayer, JsonError>)
|
Ok(deserialized.name)
|
||||||
.map(|mojang_player: MojangPlayer| mojang_player.name)?;
|
|
||||||
Ok(ign)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
|
@ -82,10 +68,9 @@ struct DiscordId {
|
||||||
impl DiscordId {
|
impl DiscordId {
|
||||||
async fn matches_fetch(user: &User, uuid: &str, client: &Client) -> Result<bool, Error> {
|
async fn matches_fetch(user: &User, uuid: &str, client: &Client) -> Result<bool, Error> {
|
||||||
let url: String = format!("https://api.hypixel.net/v2/player?uuid={}", uuid);
|
let url: String = format!("https://api.hypixel.net/v2/player?uuid={}", uuid);
|
||||||
let response: Response = client.get(url).send().await?;
|
let response_400: Response = client.get(url).send().await?.error_for_status()?;
|
||||||
let response_text = response.error_for_status()?.text().await.unwrap();
|
let deserialized = response_400.json::<HypixelResponse>().await?;
|
||||||
let matches = (serde_json::from_str(response_text.as_str()) as Result<HypixelResponse, JsonError>)
|
let matches = deserialized.player.social_media.links.discord == user.name;
|
||||||
.map(|hypixel_response: HypixelResponse| user.name == hypixel_response.player.social_media.links.discord)?;
|
|
||||||
Ok(matches)
|
Ok(matches)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +122,12 @@ pub(crate) async fn account(_ctx: Context<'_>) -> Result<(), Error> {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[poise::command(slash_command)]
|
#[poise::command(
|
||||||
|
slash_command,
|
||||||
|
install_context = "User|Guild",
|
||||||
|
interaction_context = "Guild|BotDm|PrivateChannel",
|
||||||
|
ephemeral = "false",
|
||||||
|
)]
|
||||||
pub(crate) async fn add<'a>(
|
pub(crate) async fn add<'a>(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
#[description = "Minecraft username"]
|
#[description = "Minecraft username"]
|
||||||
|
@ -149,7 +139,7 @@ pub(crate) async fn add<'a>(
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
ctx.defer_ephemeral().await?;
|
ctx.defer_ephemeral().await?;
|
||||||
let user: User = user.unwrap_or(ctx.author().clone());
|
let user: User = user.unwrap_or(ctx.author().clone());
|
||||||
let uuid: Uuid = Uuid::fetch(ign.as_str()).await?;
|
let uuid: Uuid = Uuid::for_ign(ign.as_str()).await?;
|
||||||
let force: bool = force.unwrap_or(false) && ctx.framework().options.owners.contains(&ctx.author().id);
|
let force: bool = force.unwrap_or(false) && ctx.framework().options.owners.contains(&ctx.author().id);
|
||||||
match DiscordId::matches_fetch(&user, uuid.get(), &ctx.data().hypixel_api_client).await? || force {
|
match DiscordId::matches_fetch(&user, uuid.get(), &ctx.data().hypixel_api_client).await? || force {
|
||||||
true => {
|
true => {
|
||||||
|
@ -215,17 +205,17 @@ pub(crate) async fn add<'a>(
|
||||||
.components(vec![CreateActionRow::Buttons(vec![
|
.components(vec![CreateActionRow::Buttons(vec![
|
||||||
CreateButton::new("accept_verification")
|
CreateButton::new("accept_verification")
|
||||||
.emoji(ReactionType::from('✅'))
|
.emoji(ReactionType::from('✅'))
|
||||||
.style(ButtonStyle::Primary),
|
.style(ButtonStyle::Secondary),
|
||||||
CreateButton::new("deny_verification")
|
CreateButton::new("deny_verification")
|
||||||
.emoji(ReactionType::from('❌'))
|
.emoji(ReactionType::from('❌'))
|
||||||
.style(ButtonStyle::Primary),
|
.style(ButtonStyle::Secondary),
|
||||||
CreateButton::new("list_accounts")
|
CreateButton::new("list_accounts")
|
||||||
.emoji(ReactionType::from('📜'))
|
.emoji(ReactionType::from('📜'))
|
||||||
.style(ButtonStyle::Secondary),
|
.style(ButtonStyle::Primary),
|
||||||
])]),
|
])]),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
ctx.send(CreateReply::default().ephemeral(false).content(status)).await?;
|
ctx.send(CreateReply::default().content(status)).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
false => Err(Error::Other(format!(
|
false => Err(Error::Other(format!(
|
||||||
|
@ -236,7 +226,12 @@ pub(crate) async fn add<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[poise::command(slash_command)]
|
#[poise::command(
|
||||||
|
slash_command,
|
||||||
|
install_context = "User|Guild",
|
||||||
|
interaction_context = "Guild|BotDm|PrivateChannel",
|
||||||
|
ephemeral = "false",
|
||||||
|
)]
|
||||||
pub(crate) async fn list(ctx: Context<'_>, user: Option<User>) -> Result<(), Error> {
|
pub(crate) async fn list(ctx: Context<'_>, user: Option<User>) -> Result<(), Error> {
|
||||||
ctx.defer_ephemeral().await?;
|
ctx.defer_ephemeral().await?;
|
||||||
cooldown(&ctx, 600, 300)?;
|
cooldown(&ctx, 600, 300)?;
|
||||||
|
@ -252,7 +247,13 @@ pub(crate) async fn list(ctx: Context<'_>, user: Option<User>) -> Result<(), Err
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[poise::command(context_menu_command="Account list")]
|
#[poise::command(
|
||||||
|
slash_command,
|
||||||
|
install_context = "User|Guild",
|
||||||
|
interaction_context = "Guild|PrivateChannel",
|
||||||
|
ephemeral = "false",
|
||||||
|
context_menu_command="Account list"
|
||||||
|
)]
|
||||||
pub(crate) async fn context_list(ctx: Context<'_>, u: User) -> Result<(), Error> {
|
pub(crate) async fn context_list(ctx: Context<'_>, u: User) -> Result<(), Error> {
|
||||||
ctx.defer_ephemeral().await?;
|
ctx.defer_ephemeral().await?;
|
||||||
cooldown(&ctx, 600, 300)?;
|
cooldown(&ctx, 600, 300)?;
|
||||||
|
@ -290,7 +291,7 @@ pub(crate) async fn list_string(pool: &Pool<Sqlite>, user: &User) -> Result<Stri
|
||||||
|
|
||||||
#[poise::command(slash_command)]
|
#[poise::command(slash_command)]
|
||||||
pub(crate) async fn remove(_ctx: Context<'_>) -> Result<(), Error> {
|
pub(crate) async fn remove(_ctx: Context<'_>) -> Result<(), Error> {
|
||||||
unimplemented!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn link_id_from_minecraft(pool: &Pool<Sqlite>, minecraft_uuid: &str) -> Option<u16> {
|
async fn link_id_from_minecraft(pool: &Pool<Sqlite>, minecraft_uuid: &str) -> Option<u16> {
|
||||||
|
|
|
@ -5,7 +5,13 @@ use poise::CreateReply;
|
||||||
use crate::Context;
|
use crate::Context;
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
|
|
||||||
#[poise::command(slash_command, guild_only, owners_only)]
|
#[poise::command(
|
||||||
|
slash_command,
|
||||||
|
owners_only,
|
||||||
|
install_context = "User",
|
||||||
|
interaction_context = "Guild|BotDm|PrivateChannel",
|
||||||
|
ephemeral = "false",
|
||||||
|
)]
|
||||||
pub(crate) async fn bots(
|
pub(crate) async fn bots(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
#[min = 0_u8]
|
#[min = 0_u8]
|
||||||
|
@ -15,6 +21,6 @@ pub(crate) async fn bots(
|
||||||
ctx.defer_ephemeral().await?;
|
ctx.defer_ephemeral().await?;
|
||||||
*ctx.data().bots.write().await = bots;
|
*ctx.data().bots.write().await = bots;
|
||||||
let content = format!("{} bots are now registered as available", bots).to_string();
|
let content = format!("{} bots are now registered as available", bots).to_string();
|
||||||
ctx.send(CreateReply::default().content(content).ephemeral(true)).await?;
|
ctx.send(CreateReply::default().content(content)).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,12 @@ use crate::commands::command_helper;
|
||||||
use crate::Context;
|
use crate::Context;
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
|
|
||||||
#[poise::command(slash_command, guild_only)]
|
#[poise::command(
|
||||||
|
slash_command,
|
||||||
|
install_context = "Guild",
|
||||||
|
interaction_context = "Guild",
|
||||||
|
ephemeral = "false",
|
||||||
|
)]
|
||||||
pub(crate) async fn helpstart(
|
pub(crate) async fn helpstart(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
#[min = 1_u8]
|
#[min = 1_u8]
|
||||||
|
@ -34,8 +39,6 @@ pub(crate) async fn helpstart(
|
||||||
.ephemeral(false)
|
.ephemeral(false)
|
||||||
.allowed_mentions(CreateAllowedMentions::new().roles(vec![ping]))
|
.allowed_mentions(CreateAllowedMentions::new().roles(vec![ping]))
|
||||||
};
|
};
|
||||||
if let Err(why) = ctx.send(reply).await {
|
ctx.send(reply).await?;
|
||||||
println!("Error sending message: {why}")
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,12 @@ pub enum Difficulty {
|
||||||
#[name = "R.I.P."]
|
#[name = "R.I.P."]
|
||||||
Rip,
|
Rip,
|
||||||
}
|
}
|
||||||
#[poise::command(slash_command, guild_only)]
|
#[poise::command(
|
||||||
|
slash_command,
|
||||||
|
install_context = "Guild",
|
||||||
|
interaction_context = "Guild",
|
||||||
|
ephemeral = "false",
|
||||||
|
)]
|
||||||
pub(crate) async fn lfg(
|
pub(crate) async fn lfg(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
#[rename = "map"] map: Map,
|
#[rename = "map"] map: Map,
|
||||||
|
@ -115,9 +120,7 @@ pub(crate) async fn lfg(
|
||||||
.ephemeral(false)
|
.ephemeral(false)
|
||||||
.allowed_mentions(CreateAllowedMentions::new().roles(vec![ping]));
|
.allowed_mentions(CreateAllowedMentions::new().roles(vec![ping]));
|
||||||
|
|
||||||
if let Err(why) = ctx.send(reply).await {
|
ctx.send(reply).await?;
|
||||||
println!("Error sending message: {why}");
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
#[derive(Debug, poise::ChoiceParameter)]
|
#[derive(Debug, poise::ChoiceParameter)]
|
||||||
|
@ -133,7 +136,13 @@ enum ExpertMap {
|
||||||
#[name = "Speedrun"]
|
#[name = "Speedrun"]
|
||||||
Speedrun,
|
Speedrun,
|
||||||
}
|
}
|
||||||
#[poise::command(slash_command, guild_only, rename = "lfg-expert")]
|
#[poise::command(
|
||||||
|
slash_command,
|
||||||
|
install_context = "Guild",
|
||||||
|
interaction_context = "Guild",
|
||||||
|
ephemeral = "false",
|
||||||
|
rename = "lfg-expert"
|
||||||
|
)]
|
||||||
pub(crate) async fn expert(
|
pub(crate) async fn expert(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
#[rename = "map"] mode: ExpertMap,
|
#[rename = "map"] mode: ExpertMap,
|
||||||
|
@ -192,9 +201,7 @@ pub(crate) async fn expert(
|
||||||
.content("You do not have any of the required expert ranks.")
|
.content("You do not have any of the required expert ranks.")
|
||||||
.ephemeral(true),
|
.ephemeral(true),
|
||||||
};
|
};
|
||||||
if let Err(why) = ctx.send(reply).await {
|
ctx.send(reply).await?;
|
||||||
println!("Error sending message: {why}");
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +210,13 @@ enum OtherPing {
|
||||||
#[name = "GeoGuessr"]
|
#[name = "GeoGuessr"]
|
||||||
GeoGuessr,
|
GeoGuessr,
|
||||||
}
|
}
|
||||||
#[poise::command(slash_command, guild_only, rename = "lfg-other")]
|
#[poise::command(
|
||||||
|
slash_command,
|
||||||
|
install_context = "Guild",
|
||||||
|
interaction_context = "Guild",
|
||||||
|
ephemeral = "false",
|
||||||
|
rename = "lfg-other"
|
||||||
|
)]
|
||||||
pub(crate) async fn other(
|
pub(crate) async fn other(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
#[rename = "game"] game: OtherPing,
|
#[rename = "game"] game: OtherPing,
|
||||||
|
@ -231,9 +244,7 @@ pub(crate) async fn other(
|
||||||
.ephemeral(false)
|
.ephemeral(false)
|
||||||
.allowed_mentions(CreateAllowedMentions::new().roles(vec![ping]));
|
.allowed_mentions(CreateAllowedMentions::new().roles(vec![ping]));
|
||||||
|
|
||||||
if let Err(why) = ctx.send(reply).await {
|
ctx.send(reply).await?;
|
||||||
println!("Error sending message: {why}");
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,13 @@ const XD: &str = "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||||
⣿⣿⣿⠿⠛⠁⠀⠀⠀⠙⠻⣿⣿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠈⠛⠻⡿⠟⠛⠁⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⣀⣴⣾⣿⣿⣿⣿⣿⣿⣿\n⣿⣿⣿⣶⣶⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣶⣶⣷⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n\
|
⣿⣿⣿⠿⠛⠁⠀⠀⠀⠙⠻⣿⣿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠈⠛⠻⡿⠟⠛⠁⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⣀⣴⣾⣿⣿⣿⣿⣿⣿⣿\n⣿⣿⣿⣶⣶⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣶⣶⣷⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n\
|
||||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n";
|
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n";
|
||||||
|
|
||||||
#[poise::command(slash_command)]
|
#[poise::command(
|
||||||
|
slash_command,
|
||||||
|
owners_only,
|
||||||
|
install_context = "User|Guild",
|
||||||
|
interaction_context = "Guild|BotDm|PrivateChannel",
|
||||||
|
ephemeral = "false",
|
||||||
|
)]
|
||||||
pub(crate) async fn xd(ctx: Context<'_>) -> Result<(), Error> {
|
pub(crate) async fn xd(ctx: Context<'_>) -> Result<(), Error> {
|
||||||
ctx.defer_ephemeral().await?;
|
ctx.defer_ephemeral().await?;
|
||||||
ctx.say(XD).await?;
|
ctx.say(XD).await?;
|
||||||
|
|
12
src/error.rs
12
src/error.rs
|
@ -14,7 +14,6 @@ macro_rules! reply_fail_handler {
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
SqlxError(sqlx::Error),
|
SqlxError(sqlx::Error),
|
||||||
HttpsError(reqwest::Error),
|
HttpsError(reqwest::Error),
|
||||||
ParsingError(serde_json::Error),
|
|
||||||
SerenityError(serenity::Error),
|
SerenityError(serenity::Error),
|
||||||
OnCooldown(std::time::Duration),
|
OnCooldown(std::time::Duration),
|
||||||
Other(String),
|
Other(String),
|
||||||
|
@ -25,11 +24,8 @@ impl std::fmt::Display for Error {
|
||||||
match self {
|
match self {
|
||||||
Error::SqlxError(e) => write!(f, "SQLx Error: {}", e),
|
Error::SqlxError(e) => write!(f, "SQLx Error: {}", e),
|
||||||
Error::HttpsError(e) => write!(f, "HTTPS Error (Hypixel / Mojang API):\n{}", e),
|
Error::HttpsError(e) => write!(f, "HTTPS Error (Hypixel / Mojang API):\n{}", e),
|
||||||
Error::ParsingError(e) => write!(f, "Parsing Error:\n {}", e),
|
|
||||||
Error::SerenityError(e) => write!(f, "Discord Error:\n {}", e),
|
Error::SerenityError(e) => write!(f, "Discord Error:\n {}", e),
|
||||||
Error::OnCooldown(d) => {
|
Error::OnCooldown(d) => write!(f, "This command is on cooldown. {}s remaining.", d.as_secs()),
|
||||||
write!(f, "This command is on cooldown. {}s remaining.", d.as_secs())
|
|
||||||
}
|
|
||||||
Error::Other(s) => write!(f, "{}", s),
|
Error::Other(s) => write!(f, "{}", s),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,12 +43,6 @@ impl From<reqwest::Error> for Error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<serde_json::Error> for Error {
|
|
||||||
fn from(error: serde_json::Error) -> Self {
|
|
||||||
Error::ParsingError(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<serenity::Error> for Error {
|
impl From<serenity::Error> for Error {
|
||||||
fn from(error: serenity::Error) -> Self {
|
fn from(error: serenity::Error) -> Self {
|
||||||
Error::SerenityError(error)
|
Error::SerenityError(error)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use serenity::all::{ButtonStyle, ComponentInteraction};
|
|
||||||
use serenity::all::ButtonStyle::Success;
|
use serenity::all::ButtonStyle::Success;
|
||||||
use serenity::all::ComponentInteractionDataKind;
|
use serenity::all::ComponentInteractionDataKind;
|
||||||
use serenity::all::Context;
|
use serenity::all::Context;
|
||||||
|
@ -12,9 +11,10 @@ use serenity::all::GuildId;
|
||||||
use serenity::all::Interaction;
|
use serenity::all::Interaction;
|
||||||
use serenity::all::ReactionType;
|
use serenity::all::ReactionType;
|
||||||
use serenity::all::RoleId;
|
use serenity::all::RoleId;
|
||||||
|
use serenity::all::{ButtonStyle, ComponentInteraction};
|
||||||
|
|
||||||
use crate::Data;
|
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
|
use crate::Data;
|
||||||
|
|
||||||
pub(crate) async fn component(ctx: &Context, interaction: &Interaction, data: &Data) -> Result<(), Error> {
|
pub(crate) async fn component(ctx: &Context, interaction: &Interaction, data: &Data) -> Result<(), Error> {
|
||||||
let component = interaction.clone().message_component().unwrap();
|
let component = interaction.clone().message_component().unwrap();
|
||||||
|
@ -29,9 +29,6 @@ async fn button(ctx: &Context, mut interaction: ComponentInteraction, data: &Dat
|
||||||
let u = m.mentions.first().expect("Message did not mention a user.");
|
let u = m.mentions.first().expect("Message did not mention a user.");
|
||||||
match interaction.data.custom_id.as_str() {
|
match interaction.data.custom_id.as_str() {
|
||||||
"accept_verification" => {
|
"accept_verification" => {
|
||||||
let _dm = u
|
|
||||||
.direct_message(ctx, CreateMessage::new().content("Your verified minecraft account was approved."))
|
|
||||||
.await?;
|
|
||||||
let member = m
|
let member = m
|
||||||
.guild_id
|
.guild_id
|
||||||
.unwrap_or(GuildId::new(1256217633959841853_u64))
|
.unwrap_or(GuildId::new(1256217633959841853_u64))
|
||||||
|
@ -39,6 +36,9 @@ async fn button(ctx: &Context, mut interaction: ComponentInteraction, data: &Dat
|
||||||
.await?;
|
.await?;
|
||||||
member.add_role(ctx, RoleId::new(1256218805911425066_u64)).await?;
|
member.add_role(ctx, RoleId::new(1256218805911425066_u64)).await?;
|
||||||
member.remove_role(ctx, RoleId::new(1256253358701023232_u64)).await?;
|
member.remove_role(ctx, RoleId::new(1256253358701023232_u64)).await?;
|
||||||
|
let _dm = u
|
||||||
|
.direct_message(ctx, CreateMessage::new().content("Your verified minecraft account was approved."))
|
||||||
|
.await?;
|
||||||
interaction
|
interaction
|
||||||
.message
|
.message
|
||||||
.edit(
|
.edit(
|
||||||
|
@ -52,7 +52,9 @@ async fn button(ctx: &Context, mut interaction: ComponentInteraction, data: &Dat
|
||||||
.emoji(ReactionType::from('❌'))
|
.emoji(ReactionType::from('❌'))
|
||||||
.style(ButtonStyle::Secondary)
|
.style(ButtonStyle::Secondary)
|
||||||
.disabled(true),
|
.disabled(true),
|
||||||
CreateButton::new("list_accounts").emoji(ReactionType::from('📜')),
|
CreateButton::new("list_accounts")
|
||||||
|
.emoji(ReactionType::from('📜'))
|
||||||
|
.style(ButtonStyle::Primary),
|
||||||
])]),
|
])]),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -75,7 +77,9 @@ async fn button(ctx: &Context, mut interaction: ComponentInteraction, data: &Dat
|
||||||
.emoji(ReactionType::from('❌'))
|
.emoji(ReactionType::from('❌'))
|
||||||
.style(ButtonStyle::Danger)
|
.style(ButtonStyle::Danger)
|
||||||
.disabled(true),
|
.disabled(true),
|
||||||
CreateButton::new("list_accounts").emoji(ReactionType::from('📜')),
|
CreateButton::new("list_accounts")
|
||||||
|
.emoji(ReactionType::from('📜'))
|
||||||
|
.style(ButtonStyle::Primary),
|
||||||
])]),
|
])]),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
@ -96,13 +96,11 @@ async fn event_handler(
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
match event {
|
match event {
|
||||||
FullEvent::Ready { data_about_bot, .. } => {
|
FullEvent::Ready { data_about_bot, .. } => {
|
||||||
println!("Logged in as {}", data_about_bot.user.name);
|
println!("Logged in as '{}'!", data_about_bot.user.name);
|
||||||
},
|
},
|
||||||
FullEvent::GuildMemberAddition { new_member } => {
|
FullEvent::GuildMemberAddition { new_member } => {
|
||||||
println!("join event");
|
|
||||||
if new_member.guild_id.get() == 1256217633959841853_u64 {
|
if new_member.guild_id.get() == 1256217633959841853_u64 {
|
||||||
new_member.add_role(ctx, RoleId::new(1256253358701023232_u64)).await?;
|
new_member.add_role(ctx, RoleId::new(1256253358701023232_u64)).await?;
|
||||||
println!("gave member role");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FullEvent::InteractionCreate { interaction } => {
|
FullEvent::InteractionCreate { interaction } => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue