Fix conflicts
This commit is contained in:
parent
71acc6f62e
commit
130be477d0
|
@ -1,6 +1,5 @@
|
||||||
/target
|
/target
|
||||||
/.vs/*
|
/.vscode
|
||||||
!/.vs/settings.json
|
|
||||||
/logging/
|
/logging/
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
Conf.toml
|
Conf.toml
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"rust-analyzer.cargo.features": [
|
|
||||||
"music"
|
|
||||||
],
|
|
||||||
"rust-analyzer.cargo.loadOutDirsFromCheck": true,
|
|
||||||
"rust-analyzer.procMacro.enable": true
|
|
||||||
}
|
|
|
@ -22,11 +22,6 @@ futures = "0.3"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
<<<<<<< HEAD
|
|
||||||
log4rs = "0.13"
|
|
||||||
ctrlc = "3.1"
|
|
||||||
songbird = { version = "0.1.0", features = ["driver"], optional = true }
|
|
||||||
=======
|
|
||||||
log4rs = "1.0"
|
log4rs = "1.0"
|
||||||
ctrlc = "3.1"
|
ctrlc = "3.1"
|
||||||
>>>>>>> 5794295d3a1a5477a1c417879da0f0c284160c7f
|
songbird = { version = "0.1.0", features = ["driver"], optional = true }
|
|
@ -30,7 +30,6 @@ async fn shot(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
||||||
} else {
|
} else {
|
||||||
api::send_reply(&ctx, &msg, format!("Click ! Reloading")).await?;
|
api::send_reply(&ctx, &msg, format!("Click ! Reloading")).await?;
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
} else {
|
} else {
|
||||||
api::send_reply(
|
api::send_reply(
|
||||||
ctx,
|
ctx,
|
||||||
|
@ -38,65 +37,6 @@ async fn shot(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
||||||
format!("Error : {} is not a valid argument", args.message()),
|
format!("Error : {} is not a valid argument", args.message()),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
=======
|
|
||||||
} else if let Err(e) = api::send_reply(
|
|
||||||
ctx,
|
|
||||||
msg,
|
|
||||||
format!("Error : {} is not a valid argument", args.message()),
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
error!("Error : {:?}", e);
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[command]
|
|
||||||
#[description = "Reload"]
|
|
||||||
#[bucket = "roulette"]
|
|
||||||
async fn reload(ctx: &Context, msg: &Message) -> CommandResult {
|
|
||||||
if let Err(e) = _reload(ctx, msg).await {
|
|
||||||
error!("{}", e);
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn _reload(ctx: &Context, msg: &Message) -> commands::Result<()> {
|
|
||||||
let mut data = ctx.data.write().await;
|
|
||||||
let bullets_map = data
|
|
||||||
.get_mut::<BulletsContainer>()
|
|
||||||
.expect("Expected CommandCounter in TypeMap.");
|
|
||||||
bullets_map.insert(msg.author.id.0, (5, rand::thread_rng().gen_range(0..6)));
|
|
||||||
msg.react(ctx, ReactionType::Unicode(String::from("✅")))
|
|
||||||
.await?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[command]
|
|
||||||
#[description = "If you use that, you are a coward"]
|
|
||||||
async fn check(ctx: &Context, msg: &Message) -> CommandResult {
|
|
||||||
let mut data = ctx.data.write().await;
|
|
||||||
let bullets_map = data
|
|
||||||
.get_mut::<BulletsContainer>()
|
|
||||||
.expect("Expected CommandCounter in TypeMap.");
|
|
||||||
let bullets = bullets_map
|
|
||||||
.entry(msg.author.id.0)
|
|
||||||
.or_insert((5, rand::thread_rng().gen_range(0..6)));
|
|
||||||
msg.channel_id.say(ctx, format!("Because you are a little shit, you open your barrel and you see that the bullet was at the {} position", bullet_to_str(bullets.1 + 1))).await?;
|
|
||||||
debug!("Bullets Map : {:?}", bullets_map);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bullet_to_str<'m>(nbr: u8) -> &'m str {
|
|
||||||
match nbr {
|
|
||||||
1 => "first",
|
|
||||||
2 => "second",
|
|
||||||
3 => "third",
|
|
||||||
4 => "fourth",
|
|
||||||
5 => "fifth",
|
|
||||||
6 => "sixth",
|
|
||||||
_ => unimplemented!(),
|
|
||||||
>>>>>>> 5794295d3a1a5477a1c417879da0f0c284160c7f
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -120,8 +60,7 @@ async fn kick(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
} else {
|
} else {
|
||||||
<<<<<<< HEAD
|
if rand::thread_rng().gen_range(0..6) == 0 {
|
||||||
if rand::thread_rng().gen_range(0, 6) == 0 {
|
|
||||||
api::send_reply(ctx, &msg, "💥").await?;
|
api::send_reply(ctx, &msg, "💥").await?;
|
||||||
|
|
||||||
msg.author
|
msg.author
|
||||||
|
@ -129,17 +68,6 @@ async fn kick(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
.await?
|
.await?
|
||||||
.send_message(&ctx.http, |m| m.content("<:cheh:780736245675982909>"))
|
.send_message(&ctx.http, |m| m.content("<:cheh:780736245675982909>"))
|
||||||
.await?;
|
.await?;
|
||||||
=======
|
|
||||||
let bullets_map = data
|
|
||||||
.get_mut::<BulletsContainer>()
|
|
||||||
.expect("Expected CommandCounter in TypeMap.");
|
|
||||||
let bullets = bullets_map
|
|
||||||
.entry(msg.author.id.0)
|
|
||||||
.or_insert((5, rand::thread_rng().gen_range(0..6)));
|
|
||||||
if bullets.0 == bullets.1 {
|
|
||||||
api::send_reply(ctx, &msg, "💥").await?;
|
|
||||||
*bullets = (5, rand::thread_rng().gen_range(0..6));
|
|
||||||
>>>>>>> 5794295d3a1a5477a1c417879da0f0c284160c7f
|
|
||||||
|
|
||||||
guild_id
|
guild_id
|
||||||
.member(&ctx.http, &msg.author)
|
.member(&ctx.http, &msg.author)
|
||||||
|
|
25
src/main.rs
25
src/main.rs
|
@ -27,10 +27,12 @@ use std::{
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
use tokio::{fs::File, io::AsyncWriteExt};
|
use tokio::{fs::File, io::AsyncWriteExt};
|
||||||
|
|
||||||
|
#[cfg(feature = "music")]
|
||||||
use songbird::SerenityInit;
|
use songbird::SerenityInit;
|
||||||
|
|
||||||
#[cfg(feature = "music")]
|
#[cfg(feature = "music")]
|
||||||
use crate::commands::music::{MUSIC_GROUP};
|
use crate::commands::music::MUSIC_GROUP;
|
||||||
|
|
||||||
mod api;
|
mod api;
|
||||||
mod commands;
|
mod commands;
|
||||||
|
@ -131,10 +133,13 @@ async fn main() -> IoResult<()> {
|
||||||
|
|
||||||
let mut client = Client::builder(&token)
|
let mut client = Client::builder(&token)
|
||||||
.event_handler(Messages {})
|
.event_handler(Messages {})
|
||||||
.framework(framework)
|
.framework(framework);
|
||||||
.register_songbird()
|
|
||||||
.await
|
#[cfg(feature = "music")]
|
||||||
.unwrap();
|
{
|
||||||
|
client = client.register_songbird();
|
||||||
|
};
|
||||||
|
let mut client = client.await.unwrap();
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut data = client.data.write().await;
|
let mut data = client.data.write().await;
|
||||||
|
@ -194,7 +199,7 @@ impl EventHandler for Messages {
|
||||||
.await;
|
.await;
|
||||||
tokio::time::sleep(delay).await;
|
tokio::time::sleep(delay).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn message(&self, _ctx: Context, new_message: Message) {
|
async fn message(&self, _ctx: Context, new_message: Message) {
|
||||||
if unsafe { LOG_ATTACHMENTS } && !new_message.attachments.is_empty() {
|
if unsafe { LOG_ATTACHMENTS } && !new_message.attachments.is_empty() {
|
||||||
|
@ -215,14 +220,17 @@ impl EventHandler for Messages {
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
channel_id: ChannelId,
|
channel_id: ChannelId,
|
||||||
deleted_message_id: MessageId,
|
deleted_message_id: MessageId,
|
||||||
_guild_id: Option<GuildId>
|
_guild_id: Option<GuildId>,
|
||||||
) {
|
) {
|
||||||
let message = ctx
|
let message = ctx
|
||||||
.cache()
|
.cache()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.message(channel_id, deleted_message_id)
|
.message(channel_id, deleted_message_id)
|
||||||
.await;
|
.await;
|
||||||
log::debug!("Deletted message : {:?}", message.as_ref().map(|m| &m.content));
|
log::debug!(
|
||||||
|
"Deletted message : {:?}",
|
||||||
|
message.as_ref().map(|m| &m.content)
|
||||||
|
);
|
||||||
|
|
||||||
if let Some(message) = message {
|
if let Some(message) = message {
|
||||||
if let Some(guild_id) = message.guild_id {
|
if let Some(guild_id) = message.guild_id {
|
||||||
|
@ -230,7 +238,6 @@ impl EventHandler for Messages {
|
||||||
let mut data = ctx.data.write().await;
|
let mut data = ctx.data.write().await;
|
||||||
let guilds_options = data.get_mut::<GuildOptionsKey>().unwrap();
|
let guilds_options = data.get_mut::<GuildOptionsKey>().unwrap();
|
||||||
|
|
||||||
|
|
||||||
let entry = guilds_options
|
let entry = guilds_options
|
||||||
.entry(guild_id)
|
.entry(guild_id)
|
||||||
.or_insert_with(|| GuildOptions::default().set_guild_id(guild_id));
|
.or_insert_with(|| GuildOptions::default().set_guild_id(guild_id));
|
||||||
|
|
Loading…
Reference in New Issue