mirror of
https://github.com/Noratrieb/killjoy-turret.git
synced 2026-01-16 23:55:02 +01:00
does stuff
This commit is contained in:
parent
9e34b1a6a0
commit
c41c3ff851
1 changed files with 11 additions and 16 deletions
|
|
@ -107,37 +107,32 @@ async fn autorole(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
for data in roles {
|
for data in &roles {
|
||||||
reaction_message.react(http, data.0).await?;
|
reaction_message.react(http, data.0.clone()).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut data = ctx.data.write().await;
|
let mut data = ctx.data.write().await;
|
||||||
let mut auto_roles = data.get_mut::<AutoRoleDataKey>().unwrap();
|
let mut auto_roles = data.get_mut::<AutoRoleDataKey>().unwrap();
|
||||||
|
|
||||||
|
roles
|
||||||
|
.iter()
|
||||||
|
.map(|(emoji, role)| ((emoji.id, reaction_message.id), role.id))
|
||||||
|
.for_each(|(key, value)| {
|
||||||
|
auto_roles.messages.insert(key, value);
|
||||||
|
});
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct AutoRoleData {
|
pub struct AutoRoleData {
|
||||||
messages: Vec<HashMap<DEmote, DRole>>,
|
messages: HashMap<(EmojiId, MessageId), RoleId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for AutoRoleData {
|
impl Default for AutoRoleData {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
messages: Vec::default(),
|
messages: HashMap::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Hash)]
|
|
||||||
struct DEmote {
|
|
||||||
name: String,
|
|
||||||
id: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq)]
|
|
||||||
struct DRole {
|
|
||||||
name: String,
|
|
||||||
id: String,
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue