Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
grahame
Discord Bot
Commits
7f8d9de1
Unverified
Commit
7f8d9de1
authored
Apr 05, 2020
by
tec
Browse files
Add role-react deletion technology :)
parent
a8e73b0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/reaction_roles.rs
View file @
7f8d9de1
...
@@ -97,16 +97,25 @@ pub fn sync_all_role_reactions(ctx: &Context) {
...
@@ -97,16 +97,25 @@ pub fn sync_all_role_reactions(ctx: &Context) {
for
react
in
&
message
.reactions
{
for
react
in
&
message
.reactions
{
let
react_as_string
=
get_string_from_react
(
&
react
.reaction_type
);
let
react_as_string
=
get_string_from_react
(
&
react
.reaction_type
);
if
mapping
.contains_key
(
&
react_as_string
)
{
if
mapping
.contains_key
(
&
react_as_string
)
{
continue
continue
;
}
}
info!
(
info!
(
" message #{}: Removing non-role react '{}'"
,
" message #{}: Removing non-role react '{}'"
,
i
,
react_as_string
i
,
react_as_string
);
);
for
_illegal_react
in
for
illegal_react_user
in
&
message
&
message
.reaction_users
(
ctx
,
react
.reaction_type
.clone
(),
Some
(
100
),
None
)
.reaction_users
(
&
ctx
.http
,
react
.reaction_type
.clone
(),
Some
(
100
),
None
)
.unwrap_or
(
vec!
[])
{
{
warn!
(
" need to implement react removal"
);
message
.channel_id
.delete_reaction
(
&
ctx
.http
,
message
.id
,
Some
(
illegal_react_user
.id
),
react
.reaction_type
.clone
(),
)
.expect
(
"Unable to delete react"
);
}
}
}
}
for
(
react
,
role
)
in
*
mapping
{
for
(
react
,
role
)
in
*
mapping
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment