Skip to content

Commit

Permalink
fix: Button component link
Browse files Browse the repository at this point in the history
  • Loading branch information
axonasif committed Jul 4, 2022
1 parent abc945d commit 17385d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/command/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async fn exec(ctx: &Context, _msg: &Message, mut _args: Args) -> CommandResult {
match client.execute(&executor).await {
Ok(response) => {
if let Some(c) = response.compile {
if c.code != 0 {
if c.code != Some(0) {
final_msg.push_str(c.output.as_str());
}
}
Expand Down
25 changes: 12 additions & 13 deletions src/event/interaction_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,19 +859,18 @@ pub async fn responder(ctx: Context, interaction: Interaction) {
let button_label = &mci
.message
.components
.get(0)
.unwrap()
.components
.iter()
.find_map(|x| {
let button: Button =
serde_json::from_value(serde_json::to_value(x).unwrap())
.unwrap();
if button.custom_id.unwrap() == mci.data.custom_id {
Some(button.label.unwrap())
} else {
None
}
.find_map(|a| {
a.components.iter().find_map(|x| {
let button: Button =
serde_json::from_value(serde_json::to_value(x).unwrap())
.unwrap();
if button.custom_id.unwrap() == mci.data.custom_id {
Some(button.label.unwrap())
} else {
None
}
})
})
.unwrap();

Expand Down Expand Up @@ -1254,7 +1253,7 @@ pub async fn responder(ctx: Context, interaction: Interaction) {
}
// if !relevant_links.is_empty() {
// thread
// .send_message(&ctx.http, |m| {
// .send_message(&ctx.http, |m|
// m.content(format!(
// "{} I also found some relevant links which might answer your question, please do check them out below 🙏:",
// &user_mention
Expand Down

0 comments on commit 17385d2

Please sign in to comment.