change structure, update deps, add avatar command
This commit is contained in:
parent
55e2c428e2
commit
fdd88db34c
|
@ -1,7 +1,6 @@
|
|||
/target
|
||||
/.vscode
|
||||
/logging/
|
||||
Cargo.lock
|
||||
Conf.toml
|
||||
/data
|
||||
/log
|
||||
|
|
File diff suppressed because it is too large
Load Diff
32
Cargo.toml
32
Cargo.toml
|
@ -1,27 +1,5 @@
|
|||
[package]
|
||||
name = "rusty_bot"
|
||||
version = "0.1.0"
|
||||
authors = ["oupson"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
music = ["serenity/voice", "songbird"]
|
||||
|
||||
[dependencies]
|
||||
serenity = { version = "0.10.9", features = ["unstable_discord_api"] }
|
||||
toml = "0.5"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
reqwest = "0.11"
|
||||
rand = "0.8"
|
||||
lazy_static = "1.4"
|
||||
async-trait = "0.1"
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
futures = "0.3"
|
||||
chrono = "0.4"
|
||||
serde_json = "1.0"
|
||||
log = "0.4"
|
||||
log4rs = "1.0"
|
||||
ctrlc = "3.1"
|
||||
songbird = { version = "0.1.6", features = ["driver", "builtin-queue"], optional = true }
|
||||
[workspace]
|
||||
members = [
|
||||
"rusty-bot",
|
||||
"rusty-bot-database"
|
||||
]
|
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "rusty-bot-database"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -0,0 +1 @@
|
|||
// KEEP
|
|
@ -0,0 +1,27 @@
|
|||
[package]
|
||||
name = "rusty_bot"
|
||||
version = "0.1.0"
|
||||
authors = ["oupson"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
music = ["serenity/voice", "songbird"]
|
||||
|
||||
[dependencies]
|
||||
serenity = { version = "0.10.10", features = ["unstable_discord_api"] }
|
||||
toml = "0.5"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
reqwest = "0.11"
|
||||
rand = "0.8"
|
||||
lazy_static = "1.4"
|
||||
async-trait = "0.1"
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
futures = "0.3"
|
||||
chrono = "0.4"
|
||||
serde_json = "1.0"
|
||||
log = "0.4"
|
||||
log4rs = "1.0"
|
||||
ctrlc = "3.1"
|
||||
songbird = { version = "0.2", features = ["driver", "builtin-queue", "yt-dlp"], optional = true }
|
|
@ -1,10 +1,16 @@
|
|||
use crate::{api, data::ShardManagerContainer};
|
||||
use futures::StreamExt;
|
||||
use log::error;
|
||||
use serenity::{client::bridge::gateway::ShardId, framework::standard::{
|
||||
use serenity::{
|
||||
client::bridge::gateway::ShardId,
|
||||
framework::standard::{
|
||||
macros::{command, group},
|
||||
ArgError, Args, CommandResult,
|
||||
}, http::CacheHttp, model::{interactions::message_component::ButtonStyle, prelude::*}, prelude::*};
|
||||
},
|
||||
http::CacheHttp,
|
||||
model::{interactions::message_component::ButtonStyle, prelude::*},
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
#[group]
|
||||
#[commands(
|
||||
|
@ -18,7 +24,8 @@ use serenity::{client::bridge::gateway::ShardId, framework::standard::{
|
|||
ping,
|
||||
random_mute,
|
||||
uptime,
|
||||
button
|
||||
button,
|
||||
avatar
|
||||
)]
|
||||
pub struct General;
|
||||
|
||||
|
@ -241,14 +248,6 @@ async fn ping(ctx: &Context, msg: &Message) -> CommandResult {
|
|||
#[description = "Image"]
|
||||
#[bucket = "image"]
|
||||
pub async fn image(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
||||
msg.author
|
||||
.has_role(
|
||||
ctx,
|
||||
msg.guild_id.unwrap(),
|
||||
msg.guild(ctx).await.unwrap().role_by_name("mute").unwrap(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
if let Err(e) = _image(ctx, msg, args).await {
|
||||
error!("Error in image : {:?}", e);
|
||||
}
|
||||
|
@ -370,6 +369,20 @@ async fn uptime(ctx: &Context, msg: &Message) -> CommandResult {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[description("Get the avatar of a personn")]
|
||||
async fn avatar(ctx: &Context, msg: &Message, _args : Args) -> CommandResult {
|
||||
//let a = args.parse::<UserId>()?; TODO
|
||||
if let Some(avatar_url) = &msg.author.avatar_url() {
|
||||
msg.channel_id
|
||||
.send_message(&ctx.http, |m| {
|
||||
m.embed(|e| e.image(avatar_url).colour((247, 76, 0)))
|
||||
})
|
||||
.await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// TODO JSON FILE
|
||||
enum Image {
|
||||
HackerMan(),
|
|
@ -9,7 +9,6 @@ use serenity::{
|
|||
},
|
||||
message_component::{MessageComponentInteraction, MessageComponentInteractionData},
|
||||
Interaction, InteractionApplicationCommandCallbackDataFlags, InteractionResponseType,
|
||||
MessageInteraction,
|
||||
},
|
||||
Permissions,
|
||||
},
|
|
@ -3,10 +3,9 @@ use serenity::{
|
|||
client::Context,
|
||||
framework::standard::CommandResult,
|
||||
model::{
|
||||
channel::{Message, ReactionType},
|
||||
channel::Message,
|
||||
guild::{Member, PartialMember},
|
||||
id::GuildId,
|
||||
interactions::message_component::ButtonStyle,
|
||||
Permissions,
|
||||
},
|
||||
};
|
||||
|
@ -136,6 +135,7 @@ impl<'a> CreateMessageExt for CreateMessage<'a> {
|
|||
|
||||
fn add_music_buttons<'b>(&'b mut self) -> &'b mut Self {
|
||||
return self;
|
||||
/*
|
||||
self.components(|comp| {
|
||||
comp.create_action_row(|row| {
|
||||
row.create_button(|but| {
|
||||
|
@ -165,5 +165,6 @@ impl<'a> CreateMessageExt for CreateMessage<'a> {
|
|||
})
|
||||
})
|
||||
})
|
||||
*/
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue