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
Ash
Discord Bot
Commits
920b71ea
Unverified
Commit
920b71ea
authored
Oct 20, 2019
by
tec
Browse files
Minor tweaks
parent
d7ac59f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main.rs
View file @
920b71ea
...
...
@@ -40,9 +40,10 @@ impl EventHandler for Handler {
}
let
message_content
:
Vec
<
_
>
=
msg
.content
[
1
..
]
.splitn
(
2
,
' '
)
.collect
();
match
message_content
[
0
]
{
"
register
"
=>
{
user_management
::
Commands
::
register
(
ctx
,
msg
.clone
(),
message_
content
[
1
]
)
"
say
"
=>
{
println!
(
"{:#?}"
,
msg
.
content
)
;
}
"register"
=>
user_management
::
Commands
::
register
(
ctx
,
msg
.clone
(),
message_content
[
1
]),
"join"
=>
{
user_management
::
Commands
::
join
(
ctx
,
msg
.clone
(),
message_content
[
1
]);
}
...
...
@@ -88,8 +89,8 @@ impl EventHandler for Handler {
fn
reaction_add
(
&
self
,
ctx
:
Context
,
add_reaction
:
channel
::
Reaction
)
{
match
add_reaction
.message
(
&
ctx
.http
)
{
Ok
(
message
)
=>
{
if
message
.author.id
.0
!
=
config
::
BOT_ID
{
return
if
message
.author.id
.0
=
=
config
::
BOT_ID
{
return
;
}
match
message_type
(
&
message
)
{
"motion"
=>
{
...
...
@@ -105,8 +106,8 @@ impl EventHandler for Handler {
fn
reaction_remove
(
&
self
,
ctx
:
Context
,
removed_reaction
:
channel
::
Reaction
)
{
match
removed_reaction
.message
(
&
ctx
.http
)
{
Ok
(
message
)
=>
{
if
message
.author.id
.0
!
=
config
::
BOT_ID
{
return
if
message
.author.id
.0
=
=
config
::
BOT_ID
{
return
;
}
match
message_type
(
&
message
)
{
"motion"
=>
{
...
...
@@ -168,7 +169,10 @@ fn main() {
fn
message_type
(
message
:
&
Message
)
->
&
'static
str
{
if
message
.embeds
.len
()
<=
0
{
return
"misc"
;
return
match
message
.content
.splitn
(
2
,
' '
)
.next
()
.unwrap
()
{
"Role"
=>
"role"
,
_
=>
"misc"
,
};
}
let
title
:
String
=
message
.embeds
[
0
]
.title
.clone
()
.unwrap
();
let
words_of_title
:
Vec
<
_
>
=
title
.splitn
(
2
,
' '
)
.collect
();
...
...
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