|
@@ -66,12 +66,9 @@ class Bot(val token: String) extends TelegramBot
|
|
|
*/
|
|
|
def fromAdmin(msg: Message): Boolean =
|
|
|
if (fromActualUser(msg) && fromGroup(msg)) {
|
|
|
- // it should be an actual user and a message from a group
|
|
|
- // check the user member status
|
|
|
- // get is safe as fromActualUser is called first
|
|
|
+
|
|
|
val user = new BotUser(msg.from.get, msg.chat, this)
|
|
|
- // if there is an error we cannot now whether the user is an admin or not
|
|
|
- // but it's safe in any case to reply as if the user was not an admin
|
|
|
+
|
|
|
user.isAdmin || user.isCreator
|
|
|
} else {
|
|
|
false
|
|
@@ -80,12 +77,9 @@ class Bot(val token: String) extends TelegramBot
|
|
|
|
|
|
def canBan(msg: Message): Boolean =
|
|
|
if (fromActualUser(msg) && fromGroup(msg)) {
|
|
|
- // it should be an actual user and a message from a group
|
|
|
- // check the user member status
|
|
|
- // get is safe as fromActualUser is called first
|
|
|
+
|
|
|
val user = new BotUser(msg.from.get, msg.chat, this)
|
|
|
- // if there is an error we cannot now whether the user is an admin or not
|
|
|
- // but it's safe in any case to reply as if the user was not an admin
|
|
|
+
|
|
|
user.canBanUsers
|
|
|
} else {
|
|
|
false
|