Fix non-admin chat spamming bug
This commit is contained in:
parent
ee38eea07d
commit
a2fa6e9a51
36
src/bot.rs
36
src/bot.rs
@ -122,15 +122,6 @@ impl Bot {
|
|||||||
};
|
};
|
||||||
let sender_name = self.find_player_alias(&sender_uid)?.clone();
|
let sender_name = self.find_player_alias(&sender_uid)?.clone();
|
||||||
|
|
||||||
if !self.admins.contains(&sender_name) {
|
|
||||||
self.client.send_command(
|
|
||||||
"tell".to_string(),
|
|
||||||
vec![sender_name, "You are not allowed to do that.".to_string()],
|
|
||||||
);
|
|
||||||
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
let message_parts: Vec<&str> = message
|
let message_parts: Vec<&str> = message
|
||||||
.content()
|
.content()
|
||||||
.as_plain()
|
.as_plain()
|
||||||
@ -142,6 +133,15 @@ impl Bot {
|
|||||||
|
|
||||||
match *command {
|
match *command {
|
||||||
"inv" => {
|
"inv" => {
|
||||||
|
if !self.admins.contains(&sender_name) {
|
||||||
|
self.client.send_command(
|
||||||
|
"tell".to_string(),
|
||||||
|
vec![sender_name, "You are not an admin".to_string()],
|
||||||
|
);
|
||||||
|
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if args.is_empty() {
|
if args.is_empty() {
|
||||||
self.client.send_invite(sender_uid, InviteKind::Group);
|
self.client.send_invite(sender_uid, InviteKind::Group);
|
||||||
} else {
|
} else {
|
||||||
@ -158,6 +158,15 @@ impl Bot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"kick" => {
|
"kick" => {
|
||||||
|
if !self.admins.contains(&sender_name) {
|
||||||
|
self.client.send_command(
|
||||||
|
"tell".to_string(),
|
||||||
|
vec![sender_name, "You are not an admin".to_string()],
|
||||||
|
);
|
||||||
|
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if args.is_empty() {
|
if args.is_empty() {
|
||||||
self.client.send_command(
|
self.client.send_command(
|
||||||
"tell".to_string(),
|
"tell".to_string(),
|
||||||
@ -175,6 +184,15 @@ impl Bot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"admin" => {
|
"admin" => {
|
||||||
|
if !self.admins.contains(&sender_name) {
|
||||||
|
self.client.send_command(
|
||||||
|
"tell".to_string(),
|
||||||
|
vec![sender_name, "You are not an admin".to_string()],
|
||||||
|
);
|
||||||
|
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if args.is_empty() {
|
if args.is_empty() {
|
||||||
self.client.send_command(
|
self.client.send_command(
|
||||||
"tell".to_string(),
|
"tell".to_string(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user