Secured command to prevent spam from regular users.
Main / build-and-push-docker-image (20.x) (pull_request) Successful in 3m1s
Main / build-and-push-docker-image (20.x) (pull_request) Successful in 3m1s
This commit is contained in:
@@ -15,7 +15,16 @@ feature.hears(
|
||||
logHandle("bot-info-command"),
|
||||
async (ctx: Context) => {
|
||||
// Checks if the context includes a message property.
|
||||
if (ctx.msg) {
|
||||
if (ctx.msg && ctx.chat && ctx.msg.from) {
|
||||
// Doesn't respond to regular users in groups. This is to prevent users spamming the command.
|
||||
if (ctx.chat.type !== "private") {
|
||||
const chatMember = await ctx.getChatMember(ctx.msg.from.id);
|
||||
|
||||
if (!["creator", "administrator"].includes(chatMember.status)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Replies to the message.
|
||||
await ctx.reply(
|
||||
`I am a bot designed to delete any Twitter/X and Meta links along with corresponding reformatting services\\. I now check embedded links\\!`,
|
||||
|
||||
Reference in New Issue
Block a user