conflicts
This commit is contained in:
commit
71acc6f62e
|
@ -13,8 +13,8 @@ music = ["serenity/voice", "songbird"]
|
|||
serenity = "0.10"
|
||||
toml = "0.5"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
reqwest = "0.10"
|
||||
rand = "0.7"
|
||||
reqwest = "0.11"
|
||||
rand = "0.8"
|
||||
lazy_static = "1.4"
|
||||
async-trait = "0.1"
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
|
@ -22,6 +22,11 @@ futures = "0.3"
|
|||
chrono = "0.4"
|
||||
serde_json = "1.0"
|
||||
log = "0.4"
|
||||
<<<<<<< HEAD
|
||||
log4rs = "0.13"
|
||||
ctrlc = "3.1"
|
||||
songbird = { version = "0.1.0", features = ["driver"], optional = true }
|
||||
=======
|
||||
log4rs = "1.0"
|
||||
ctrlc = "3.1"
|
||||
>>>>>>> 5794295d3a1a5477a1c417879da0f0c284160c7f
|
||||
|
|
|
@ -25,11 +25,12 @@ struct Roulette;
|
|||
async fn shot(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
||||
let _message = args.message().trim_end();
|
||||
if _message == "shot" || _message == "" {
|
||||
if rand::thread_rng().gen_range(0, 6) == 0 {
|
||||
if rand::thread_rng().gen_range(0..6) == 0 {
|
||||
api::send_reply(ctx, &msg, "💥").await?;
|
||||
} else {
|
||||
api::send_reply(&ctx, &msg, format!("Click ! Reloading")).await?;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
} else {
|
||||
api::send_reply(
|
||||
ctx,
|
||||
|
@ -37,6 +38,65 @@ async fn shot(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
|||
format!("Error : {} is not a valid argument", args.message()),
|
||||
)
|
||||
.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(())
|
||||
}
|
||||
|
@ -60,6 +120,7 @@ async fn kick(ctx: &Context, msg: &Message) -> CommandResult {
|
|||
)
|
||||
.await?;
|
||||
} else {
|
||||
<<<<<<< HEAD
|
||||
if rand::thread_rng().gen_range(0, 6) == 0 {
|
||||
api::send_reply(ctx, &msg, "💥").await?;
|
||||
|
||||
|
@ -68,6 +129,17 @@ async fn kick(ctx: &Context, msg: &Message) -> CommandResult {
|
|||
.await?
|
||||
.send_message(&ctx.http, |m| m.content("<:cheh:780736245675982909>"))
|
||||
.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
|
||||
.member(&ctx.http, &msg.author)
|
||||
|
|
39
src/main.rs
39
src/main.rs
|
@ -173,45 +173,6 @@ async fn main() -> IoResult<()> {
|
|||
|
||||
struct Messages {}
|
||||
|
||||
impl Messages {
|
||||
/*async fn _reaction_add(
|
||||
&self,
|
||||
ctx: Context,
|
||||
reaction: Reaction,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
// TODO
|
||||
let message: Message = reaction.message(&ctx.http).await?;
|
||||
if message.is_own(&ctx).await && message.content.starts_with("Do you want to take the gun")
|
||||
{
|
||||
debugln!("My own garbage !");
|
||||
let user = reaction.user(&ctx.http).await?;
|
||||
if user == message.mentions[1] {
|
||||
message.delete(&ctx.http).await?;
|
||||
if reaction.emoji
|
||||
== serenity::model::channel::ReactionType::Unicode(String::from("✅"))
|
||||
{
|
||||
let mut data = ctx.data.write().await;
|
||||
let bullets_map = data
|
||||
.get_mut::<BulletsContainer>()
|
||||
.expect("Expected CommandCounter in TypeMap.");
|
||||
if bullets_map.contains_key(&message.mentions[0].id.0) {
|
||||
let bullet_count =
|
||||
bullets_map.remove(&message.mentions[0].id.0).unwrap_or(6);
|
||||
bullets_map.insert(message.mentions[1].id.0, bullet_count);
|
||||
message.channel_id.say(&ctx, "Done").await?;
|
||||
} else {
|
||||
message
|
||||
.channel_id
|
||||
.say(&ctx, "Error : Your gun is empty")
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}*/
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl EventHandler for Messages {
|
||||
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||
|
|
Loading…
Reference in New Issue