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
UCC
Discord Bot
Commits
b0048da2
Commit
b0048da2
authored
Feb 05, 2020
by
Timothy du Heaume
Browse files
prserve insertion order of react/role mappings
parent
f39405ef
Pipeline
#155
failed with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Cargo.toml
View file @
b0048da2
...
...
@@ -16,3 +16,4 @@ serde_yaml = "^0.8"
serenity
=
"0.8.0"
simplelog
=
"^0.7.4"
guard
=
"0.5.0"
indexmap
=
{
version
=
"1.3.1"
,
features
=
["serde-1"]
}
src/config.rs
View file @
b0048da2
use
serde
::
Deserialize
;
use
serde_yaml
;
use
serenity
::
model
::
id
;
use
std
::
collections
::
Hash
Map
;
use
indexmap
::
Index
Map
;
use
std
::
fs
;
lazy_static!
{
...
...
@@ -44,8 +44,10 @@ impl UccbotConfig {
}
}
pub
type
ReactRoleMap
=
IndexMap
<
String
,
id
::
RoleId
>
;
#[derive(Debug,
Deserialize,
Clone)]
pub
struct
ReactionMapping
{
pub
message
:
serenity
::
model
::
id
::
MessageId
,
pub
mapping
:
HashMap
<
String
,
id
::
Role
Id
>
,
pub
mapping
:
React
Role
Map
,
}
src/main.rs
View file @
b0048da2
...
...
@@ -4,6 +4,7 @@ extern crate lazy_static;
#[macro_use]
extern
crate
log
;
extern
crate
simplelog
;
extern
crate
indexmap
;
#[macro_use]
extern
crate
guard
;
use
simplelog
::
*
;
use
std
::
fs
::{
read_to_string
,
File
};
...
...
src/reaction_roles.rs
View file @
b0048da2
use
crate
::
config
::
CONFIG
;
use
crate
::
config
::
{
CONFIG
,
ReactRoleMap
}
;
use
crate
::
util
::{
get_react_from_string
,
get_string_from_react
};
use
serenity
::{
client
::
Context
,
...
...
@@ -178,7 +178,7 @@ fn get_all_role_reaction_message(
ctx
:
&
Context
,
)
->
Vec
<
(
Message
,
&
'static
HashMap
<
String
,
serenity
::
model
::
id
::
Role
Id
>
,
&
'static
React
Role
Map
,
)
>
{
let
guild
=
ctx
.http
.get_guild
(
CONFIG
.server_id
)
.unwrap
();
info!
(
" Find role-react message: guild determined"
);
...
...
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