Skip to content

Instantly share code, notes, and snippets.

@luizmarcus
Created December 5, 2022 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizmarcus/e64ecd7d217b7edfdb69718c10ecb311 to your computer and use it in GitHub Desktop.
Save luizmarcus/e64ecd7d217b7edfdb69718c10ecb311 to your computer and use it in GitHub Desktop.
<?php
$message_id = $message['message_id'];
$chat_id = $message['chat']['id'];
$name = $message['from']['first_name'];
if (isset($message['text'])) {
$text = $message['text'];//texto recebido na mensagem
$result = checkBlackList($text);//checagem da pesença das palavras banidas no texto
if (strpos($text, "/blacklist") === 0) { //comando para listar as palavras banidas
sendMessage("sendMessage", array('chat_id' => $chat_id, "text" => "Olá! ".$name));
sendMessage("sendMessage", array('chat_id' => $chat_id, "text" => "As palavras que estão na blacklist são: ".implode(", ", DEFAULT_BLACKLIST)));
}else if ($result !== ""){
sendMessage("sendMessage", array('chat_id' => $chat_id, "text" => "\u{00002757} Opa, ".$name.". Cuidado com o que você digita \u{00002757}"));
sendMessage("sendMessage", array('chat_id' => $chat_id, "text" => "\u{00002934} ".$result."\r\nInfelizmente terei que deletar essa messagem.", 'reply_to_message_id' => $message_id));
sendMessage("sendMessage", array('chat_id' => $chat_id, "text" => "\u{0000274c} A mensagem será apagada em 5 segundos. \u{0000274c}"));
usleep(5000000); //espera 5 segundos
sendMessage("deleteMessage", array('chat_id' => $chat_id, 'message_id' => $message_id));
sendMessage("sendMessage", array('chat_id' => $chat_id, "text" => "Pronto, mensagem apagada! \u{00002714}"));
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment