Don't refresh icons after switching page
This commit is contained in:
parent
f995977f72
commit
07005e60e1
|
@ -107,7 +107,7 @@ impl<'a> EmbedSelector<'a> {
|
|||
{
|
||||
Ok(m) => {
|
||||
self.embed_answer = Some(m);
|
||||
self.refresh_reactions().await?;
|
||||
self.display_reactions().await?;
|
||||
Ok(self.wait_selector_end().await?)
|
||||
}
|
||||
Err(_e) => Err(CommandExecutionError::DiscordAPICallError(
|
||||
|
@ -116,7 +116,7 @@ impl<'a> EmbedSelector<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
async fn refresh_reactions(&self) -> Result<(), CommandExecutionError> {
|
||||
async fn display_reactions(&self) -> Result<(), CommandExecutionError> {
|
||||
if let Some(answer) = &self.embed_answer {
|
||||
answer.delete_reactions(self.context).await.map_err(|_e| {
|
||||
CommandExecutionError::DiscordAPICallError(
|
||||
|
@ -220,24 +220,26 @@ impl<'a> EmbedSelector<'a> {
|
|||
let tag_index: usize =
|
||||
(self.current_page - 1) * MAX_SELECTABLE_PER_PAGE + selected_nb;
|
||||
|
||||
let tag = &self.selectable[tag_index];
|
||||
if tag_index < self.selectable.len() {
|
||||
let tag = &self.selectable[tag_index];
|
||||
|
||||
if self.selection.contains(tag) {
|
||||
self.selection.remove(tag);
|
||||
} else {
|
||||
self.selection.insert(tag.clone());
|
||||
if self.selection.contains(tag) {
|
||||
self.selection.remove(tag);
|
||||
} else {
|
||||
self.selection.insert(tag.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reaction.delete(self.context).await.map_err(|_e| {
|
||||
CommandExecutionError::DiscordAPICallError(
|
||||
"Failed to delete reaction from selector".to_string(),
|
||||
)
|
||||
})?;
|
||||
|
||||
self.refresh_embed_selection().await?;
|
||||
}
|
||||
}
|
||||
|
||||
reaction.delete(self.context).await.map_err(|_e| {
|
||||
CommandExecutionError::DiscordAPICallError(
|
||||
"Failed to delete reaction from selector".to_string(),
|
||||
)
|
||||
})?;
|
||||
}
|
||||
}
|
||||
collector.stop();
|
||||
|
@ -253,7 +255,6 @@ impl<'a> EmbedSelector<'a> {
|
|||
if self.current_page != self.page_number {
|
||||
self.current_page += 1;
|
||||
self.refresh_embed_selection().await?;
|
||||
self.refresh_reactions().await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -262,7 +263,6 @@ impl<'a> EmbedSelector<'a> {
|
|||
if self.current_page != 1 {
|
||||
self.current_page -= 1;
|
||||
self.refresh_embed_selection().await?;
|
||||
self.refresh_reactions().await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue