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) => {
|
Ok(m) => {
|
||||||
self.embed_answer = Some(m);
|
self.embed_answer = Some(m);
|
||||||
self.refresh_reactions().await?;
|
self.display_reactions().await?;
|
||||||
Ok(self.wait_selector_end().await?)
|
Ok(self.wait_selector_end().await?)
|
||||||
}
|
}
|
||||||
Err(_e) => Err(CommandExecutionError::DiscordAPICallError(
|
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 {
|
if let Some(answer) = &self.embed_answer {
|
||||||
answer.delete_reactions(self.context).await.map_err(|_e| {
|
answer.delete_reactions(self.context).await.map_err(|_e| {
|
||||||
CommandExecutionError::DiscordAPICallError(
|
CommandExecutionError::DiscordAPICallError(
|
||||||
|
@ -220,6 +220,7 @@ impl<'a> EmbedSelector<'a> {
|
||||||
let tag_index: usize =
|
let tag_index: usize =
|
||||||
(self.current_page - 1) * MAX_SELECTABLE_PER_PAGE + selected_nb;
|
(self.current_page - 1) * MAX_SELECTABLE_PER_PAGE + selected_nb;
|
||||||
|
|
||||||
|
if tag_index < self.selectable.len() {
|
||||||
let tag = &self.selectable[tag_index];
|
let tag = &self.selectable[tag_index];
|
||||||
|
|
||||||
if self.selection.contains(tag) {
|
if self.selection.contains(tag) {
|
||||||
|
@ -228,16 +229,17 @@ impl<'a> EmbedSelector<'a> {
|
||||||
self.selection.insert(tag.clone());
|
self.selection.insert(tag.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.refresh_embed_selection().await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
reaction.delete(self.context).await.map_err(|_e| {
|
reaction.delete(self.context).await.map_err(|_e| {
|
||||||
CommandExecutionError::DiscordAPICallError(
|
CommandExecutionError::DiscordAPICallError(
|
||||||
"Failed to delete reaction from selector".to_string(),
|
"Failed to delete reaction from selector".to_string(),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
self.refresh_embed_selection().await?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
collector.stop();
|
collector.stop();
|
||||||
|
@ -253,7 +255,6 @@ impl<'a> EmbedSelector<'a> {
|
||||||
if self.current_page != self.page_number {
|
if self.current_page != self.page_number {
|
||||||
self.current_page += 1;
|
self.current_page += 1;
|
||||||
self.refresh_embed_selection().await?;
|
self.refresh_embed_selection().await?;
|
||||||
self.refresh_reactions().await?;
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -262,7 +263,6 @@ impl<'a> EmbedSelector<'a> {
|
||||||
if self.current_page != 1 {
|
if self.current_page != 1 {
|
||||||
self.current_page -= 1;
|
self.current_page -= 1;
|
||||||
self.refresh_embed_selection().await?;
|
self.refresh_embed_selection().await?;
|
||||||
self.refresh_reactions().await?;
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue