Compare commits

..

No commits in common. "main" and "add-license-1" have entirely different histories.

919 changed files with 827721 additions and 16257 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 MatMasIt
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,2 +1,8 @@
# RainbowBot
Telegram bot for lgbt groups
# rainbowBot
Official bot of [WeAreLGBT+ Network](https://t.me/wearelgbt_network)
A lot of mixed stuff accumulated over the years, and yes the source is terrible.
May be of help to someone

101
card.php
View File

@ -1,101 +0,0 @@
<?php
require "database/DatabaseUser.php";
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$data = json_decode($_GET["data"], true);
?>
<div class="card">
<img src="<?php echo htmlentities($data["img"]); ?>" alt="Immagine" id="pic">
<header class="eva-heading" id="cen">
<h2 class="eva-heading__title"><img src="https://images.emojiterra.com/google/android-10/512px/1f3f3-1f308.png" style="width:20px"> Rainbow Bot <img src="https://images.emojiterra.com/google/android-10/512px/1f3f3-1f308.png" style="width:20px"></h2><br />
<h4 class="eva-heading__episode-title">
<?php if ($data["name"]) {
?>
<i>Nome</i>:&nbsp;&nbsp;&nbsp;<?php echo htmlentities($data["name"]); ?> <br />
<?php
}
if ($data["birth"]) {
?>
<i>Data di Nascita</i>:&nbsp;&nbsp;&nbsp;<?php echo itdate($data["birth"]) . " (" . DatabaseUser::calcAge((int)$data["birth"]) . " anni)" ?><br />
<?php
}
if ($data["gender"]) {
?>
<i>Genere</i>:&nbsp;&nbsp;&nbsp;<?php echo htmlentities($data["gender"]); ?> <br />
<?php
}
if ($data["orientation"]) {
?>
<i>Orientamento</i>:&nbsp;&nbsp;&nbsp;<?php echo htmlentities($data["orientation"]); ?><br />
<?php
}
if ($data["where"]) {
?>
<i>Provenienza</i>:&nbsp;&nbsp;&nbsp;<?php echo htmlentities($data["where"]); ?><br />
<?php
}
if ($data["pvt"]) {
?>
<i>Messaggi privati</i>:&nbsp;&nbsp;&nbsp;<?php echo htmlentities($data["pvt"]); ?><br />
<?php
}
if ($data["rel"]) {
?>
<i>Relazioni</i>:&nbsp;&nbsp;&nbsp;<?php echo htmlentities($data["rel"]); ?><br />
<?php
}
?>
</h4>
<br />
<?php
if ($data["isDev"]) $data["flags"][] = "dev";
foreach ($data["flags"] as $flag) {
?>
<img src="flags/<?php echo htmlentities($flag); ?>.png" class="flag">
<?php
}
?>
</header>
</div>
<style>
.flag {
width: 100px;
}
.card {
width: 600px;
height: 478px;
/*border: 1px solid white;*/
}
* {
margin: 0;
padding: 0;
color: white;
font-size: 25px;
}
#pic {
width: 200px;
height: 200px;
float: right;
}
#cen {
margin-top: 32px;
margin-left: 32px;
}
body {
background-color: black;
}
h2 {
font-size: 30px;
}
</style>

View File

@ -1,16 +0,0 @@
<?php
function itdate($unix)
{
$daysIT = ["Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato", "Domenica"];
$monthsIT = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"];
return $daysIT[date("N", $unix) - 1] . " " . date("d", $unix) . " " . $monthsIT[date("m", $unix) - 1] . " " . date("Y", $unix);
}
function contains($needle, $haystack)
{
return (strpos($haystack, $needle) !== false);
}
function ellipses(string $string, int $len = 40, $ellipses = "...")
{
$slen = $len - strlen($ellipses);
return strlen($string) > $slen ? substr($string, 0, $slen) . "..." : $string;
}

View File

@ -1,5 +0,0 @@
{
"require": {
"telegram-bot/api": "^2.3"
}
}

78
composer.lock generated
View File

@ -1,78 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "4436204c0d5f43443ce858a5077afd8c",
"packages": [
{
"name": "telegram-bot/api",
"version": "v2.3.13",
"source": {
"type": "git",
"url": "https://github.com/TelegramBot/Api.git",
"reference": "8d34f3ccd3230a9fd7c7fd9ba8ec0110a059f781"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/TelegramBot/Api/zipball/8d34f3ccd3230a9fd7c7fd9ba8ec0110a059f781",
"reference": "8d34f3ccd3230a9fd7c7fd9ba8ec0110a059f781",
"shasum": ""
},
"require": {
"php": ">=5.5.0"
},
"require-dev": {
"codeception/codeception": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "2.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"TelegramBot\\Api\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ilya Gusev",
"email": "mail@igusev.ru",
"homepage": "https://php-cat.com",
"role": "Developer"
}
],
"description": "PHP Wrapper for Telegram Bot API",
"homepage": "https://github.com/TelegramBot/Api",
"keywords": [
"bot",
"bot api",
"php",
"telegram"
],
"support": {
"issues": "https://github.com/TelegramBot/Api/issues",
"source": "https://github.com/TelegramBot/Api/tree/master"
},
"time": "2018-04-30T11:46:15+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.2.0"
}

View File

@ -1,9 +1,316 @@
<?php
// censored
$GLOBALS["token"] = '';
$GLOBALS["baseurl"] = '';
$GLOBALS["urltoimagekey"] = '';
$GLOBALS["username"] = "";
$GLOBALS["masterId"] = 1;
$GLOBALS["logId"] = -1;
$GLOBALS["imageServer"] = "";
return [
"lgbt" => [
"on" => true,
"maintenance" => 1111111,
"logChannelId" => (-11111111111),
"TOKEN" => "TOKEN",
"devId"=>11111111,
"modulesEnabled" => [
"boot" => true,
"log" => true,
"watchedForward" => true,
"welcome" => true,
"registerNewUsersInDb" => true,
"happyBirthday" => true,
"updateUsernameData" => true,
".s" => true,
".stats" => true,
".raBIO" => true,
".nr" => true,
".rave" => true,
".helpb" => true,
".eq" => true,
".RWP" => true,
".NLG" => true,
".evc" => true,
".CAH" => true,
".lgbtShuffle" => true,
".kq" => true,
".ez" => true,
".card" => true,
".lookup" => true,
".tpdne" => true,
".oracolo" => true,
".marry" => true,
".nolgbt" => true,
".n" => true,
".scp" => true,
".lgbts" => true,
".forum" => true,
".usage" => true,
".anon" => true,
".joke" => true,
".no" => true,
".tutti" => true,
".i" => true,
".ii" => true,
".asuna" => true,
".watch" => true,
".unwatchAll" => true,
".listWatch" => true,
".reking" => true,
".s" => true,
".cry" => true,
".pvt" => true,
".log" => true,
".ud" => true,
".emu" => false,
".AAJuebox" => true,
".pokeJuebox" => true,
".DCJuebox" => true,
".bibbiaJuebox" => true,
".soffriggi" => true,
".prg" => false,
".imgCacheClean" => false,
".inspire" => true,
".eva" => true
],
"APIs" => [
"jokes" => "https://sv443.net/jokeapi/v2/joke/Any",
"kanye" => "https://api.kanye.rest/",
"ud" => "https://twitchsharer.com/files/urbandict.php?Term=",
"scp" => "http://www.scp-wiki.net/scp-",
"help" => "https://webport.altervista.org/bots/telegram/lgbt/help.php",
"myTable" => "https://webport.altervista.org/bots/telegram/lgbt/mytable.php",
"wikiRandom" => "https://it.wikipedia.org/api/rest_v1/page/random/summary",
"numbers" => "http://numbersapi.com/",
"inspire" => "https://inspirobot.me/api?generate=true",
"tpdne"=>"https://thispersondoesnotexist.com/image"
],
"imagesLgbts" => [
"https://i.pinimg.com/originals/00/bc/67/00bc67aae61bba3b4b0b741edf86e334.jpg",
"https://i.pinimg.com/originals/f1/aa/45/f1aa451f945020df20cd736bc1e7fa4c.png",
"https://www.itspronouncedmetrosexual.com/wp-content/uploads/2012/01/1600-Genderbread-Person.jpg",
"https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/e8b09dd4-d06b-4a29-ac04-46be3c7602c3/d7et5c6-c7c88a99-dcb1-4e90-b576-63ed011cf2d5.jpg/v1/fill/w_900,h_1379,q_75,strp/lgbt_community_terminology_and_flags_by_lovemystarfire_d7et5c6-fullview.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOiIsImlzcyI6InVybjphcHA6Iiwib2JqIjpbW3siaGVpZ2h0IjoiPD0xMzc5IiwicGF0aCI6IlwvZlwvZThiMDlkZDQtZDA2Yi00YTI5LWFjMDQtNDZiZTNjNzYwMmMzXC9kN2V0NWM2LWM3Yzg4YTk5LWRjYjEtNGU5MC1iNTc2LTYzZWQwMTFjZjJkNS5qcGciLCJ3aWR0aCI6Ijw9OTAwIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmltYWdlLm9wZXJhdGlvbnMiXX0.gXd1svAzbWRl2F_u-vwOLz4QouME1vsbcKQrdJRf2Yg"
],
"text" => [
"userView" => [
"birthDate" => "Data di nascita",
"name" => "Nome",
"yearsOld" => "Età",
"gender" => "Genere",
"orient" => "Orientamento",
"where" => "Viene da",
"pvtNotice" => "Avviso sui messaggi privati",
"bio" => "Bio"
],
"status" => [
"missingHelpFile" => "\n¬ Missing help file, this will affect the \".helpb\" command\n",
"missingJueBox" => "\n¬ Missing the Divina Commedia file!\nIts juebox will not work\n",
"missingBibleFile" => "\n¬ Missing the Bible file!\nIts juebox will not work\n",
"missingPokemonFile" => "\n¬ Missing the Pokemon Music List file!\nIts juebox will not work\n",
"missingAAFile" => "\n¬ Missing the Ace Attorney Music List file!\nIts juebox will not work\n",
"missingMyTable" => "\n¬ Missing the MyTable viewer!\nThe \".tutti\" command will not work\n",
"missingNoLgbt" => "\n¬ Missing the NoLGBT ignorance collection!\nThe \".nolgbt\" command will not work\n",
"someErrors" => "\nSome errors though:\n",
"up" => " - Up and running!"
],
"csvTell" => "Inserisci la lista in stile CSV, vai: (:q per annullare)",
"lgbtBegin" => "LGBTQIA -> ",
"kanyeSaid" => "Kanye says :\n",
"cardsAgainstHumanity" => "Cards against humanity\n",
"messageSent" => "Messaggio inviato",
"notFound" => "Non trovato",
"udHint" => "Che cosa devo cercare?\nEx: \".ud\" sos oppure cita un messaggio e scrivi \".ud\"",
"notInDbNoUsr" => "Non nel Database / Non hai selezionato nessun utente",
"noResults" => "Nessun risultato",
"parameterNotFound" => "Parametro specificato non valido",
"scpNotFound" => "SCP non trovato",
"whichScp" => "Quale scp?\nEx: \".scp\" 1471 oppure cita un messaggio e scrivi \".scp\"",
"notInDb" => "Non nel Database ",
"yesMaster" => "Yes, master",
"purgeBegin" => "Starting the P U R G E.\n this may take a while; the bot may become unresponsive",
"purged" => " Old records P U R G E D.",
"fry" => "Vi ho contattato ma non mi avete scritto?\nOra vi soffriggo\n*RUMORE DI OLIO DA FRITTURA*",
"cry" => "I am going to make @MtMsdns cry:\nhttps://www.youtube.com/playlist?list=PLsAXnLyfCDZZHhEE2z6LS10eIOhR6Qiaw",
"info" => "v 4.1.0 by @MtMsdns e @xSylla",
"pvt" => "Controlla se l'utente vuole essere contattato in privato tramite .lookup!",
"nolgbt" => "Ecco la mirabile opera : https://webport.altervista.org/bots/telegram/lgbt/ignorance/",
"timeDiffFormat" => "%a giorni, %h ore, %i minuti and %s secondi",
"maintenance" => "Bot in manutenzione",
"whatEdit" => "Cosa vuoi modificare?",
"numberEdit" => "Scrivi il numero dell'opzione corrispondente",
"finishText" => "Abbiamo finito. Ora su @wearelgbtq, \"Lella Land\" e @TransgenderCommunity tutti potranno consultare i tuoi dati. Per fare opt-out scrivi \"opt-out\", per correggere i tuoi dati scrivi \"edit\", per vederli scrivi \"me\" e per rifare la configurazione scrivi \"redo\"\n Ricordati di fare .lookup su un utente prima di scrivergli per vedere se vuole!",
"welcomeText" => "Ciao, ti farò alcune domande.\n Rispondi \"No\" se non vuoi rispondere alla domanda corrente.\nLe Informazioni saranno visibili a tutti sul gruppo LGBT e sul gruppo transgender (@wearelgbtq e @TransgenderCommunity, + il gruppo \"Lella Land\" ) con il comando .lookup finché non richiederai l'opt-out, ossia la cancellazione dei tuoi dati.\nProcedendo dichiari di aver preso visione di questo messaggio.",
"nameAsk" => "Come ti chiami?",
"groupHello" => "Ciao, mi puoi scrivere in privato? Gestisco l'archivio dei profili su questo gruppo e se carichi i tuoi dati potrai partecipare più attivamente!",
"alreadyKnowYou" => "Ah, ma già ti conosco!, ecco :\n",
"seenButEmptyRecord" => "Ti ho già visto in passato..\n Ma non so nulla di te.\nVuoi scrivermi?",
"mustCite" => "Devi citare un messaggio o scriverlo dopo il comando",
"eye" => "Keeping an eye",
"freeBeg" => "Freedom for ",
"allFree" => "In this land all are already free",
"wrongOpinion" => "Ding Dong, Your opinion is wrong",
"cryPlaylist" => "https://youtu.be/s_NXt2ZPtzg",
"statsDisclaimer" => "STATISTICHE\nDisclaimer: faccio del mio meglio per fare il parsing ma magari padellasessuale non lo capisco bene\nORIENTAMENTI\n",
"noProblem" => "Nessun problema",
"thanks" => "Grazie",
"updatedData" => "Dati aggiornati",
"birthAsk" => "Ma dimmi, quando sei nat* (scrivi la data nel formato gg/mm/aaaa)",
"genderAsk" => "Qual è il tuo genere?",
"orientAsk" => "Qual' è il tuo orientamento?",
"whereFrom" => "Da dove vieni?",
"invalidDate" => "Data invalida",
"bioM"=>"Scrivi una breve bio ",
"invalidChoice" => "Scelta non valida",
"shortDescription" => "Lascia una breve nota per chi vuole mandarti messaggi privati: li vuoi? A che condizioni?",
"isUnderObservation" => " é sotto osservazione.\nTutti i suoi messaggi verranno inoltrati qui!\n usare .unwatch per eliminarlo dalla lista degli osservati.",
"done" => "Fatto",
"cancelled" => "Annullato",
"freedom" => "Freedom!",
"notObservedAnymore" => "non é più osservato",
"reroll" => "Reroll!\nIl re LGBT di oggi :\n",
"newGroupMember" => ")\nNuovo membro entrato nel gruppo:\n",
"theMarriage" => "Il matrimonio tra ",
"isSet" => ") è ora ufficiale e irrevocabile.\nCosì è stato deciso\n[Musica di Forum]",
"scheduledMaintenance" => "Bot in manutenzione programmata. Fine : ",
"wiiText" => " nel canale \"Vota Anche Tu\" della wii di Mat é apparso il seguente sondaggio ",
"resultsWere" => "I risultati furono\n\n",
"secret" => "Segreto:\n\n",
"ok" => "OK",
"writeYourSecret" => "Scrivi il tuo segreto (o \"q\" per annullare)",
"willSend" => "Lo invierà sul gruppo che sceglierai, vai: (:q per annullare)",
"dataErased" => "Dati eliminati",
"happyBirthdayTo" => "Buon compleanno a ",
"todaysKing" => "Il re LGBT di oggi :\n",
"noLaLgbtplz" =>"Perfavore, non usare \"La lgbt\", non è una azienda (LGBT S.p.A., LGBT Inc.) o una associazione.\nTutte le volte che lo fai, @MtMsdns piange.\nEsempi alternativi: \n\"La community LGBT\", \"La community Queer\"\nThanks"
],
"correlationMenu" => [
["Nome", "askDm"],
["Data di Nascita", "askName"],
["Genere", "askBirth"],
["Orientamento", "askGender"],
["Luogo di provenienza", "askOrient"],
["Nota per i messaggi privati", "askWhere"],
["Bio", "askPVT"],
["annulla", "end"]
],
"groups" => [
[
"uid" => 1,
"id" => (-11111111),
"name" => "We are lgbtq",
"on" => true,
"maintenance" => false,
"modules" => [
"king" => 0, //0-> all, 1 -> people who are in the group, 2-> none
"marriage" => 0,
"happyBirthday" => 0
]
],
[
"uid" => 2,
"id" => (-11111111),
"name" => "Transgender Community",
"on" => true,
"maintenance" => false,
"modules" => [
"king" => 2,
"marriage" => 2,
"happyBirthday" => 2
]
],
[
"uid" => 3,
"id" => (-11111111),
"name" => "LellaLand",
"on" => true,
"maintenance" => false,
"modules" => [
"king" => 2,
"marriage" => 2,
"happyBirthday" => 2
]
],
[
"uid" => 4,
"id" => (-11111111),
"name" => "We are LGBT+ but more horny",
"on" => true,
"maintenance" => false,
"modules" => [
"king" => 2,
"marriage" => 2,
"happyBirthday" => 2
],
"modulesEnabled" => [
".lookup" => false,
".card" => false,
".marry" => false,
".stats" => false,
".debugUser" => false
]
],
[
"uid" => 5,
"id" => (-111111111),
"name" => "Gruppo Staff",
"on" => true,
"maintenance" => false,
"modules" => [
"king" => 2,
"marriage" => 2,
"happyBirthday" => 2
],
"modulesEnabled" => [
".lookup" => false,
".card" => false,
".marry" => false,
".stats" => false,
".debugUser" => false
]
],
[
"uid" => 6,
"id" => (-111111111),
"name" => "Bot Test",
"on" => true,
"maintenance" => false,
"modules" => [
"king" => 2,
"marriage" => 2,
"happyBirthday" => 2
],
"modulesEnabled" => [
".lookup" => false,
".card" => false,
".marry" => false,
".stats" => false,
".debugUser" => false
]
],
[
"uid" => 7,
"id" => (-1111111111),
"name" => "Canale Log",
"on" => true,
"maintenance" => false,
"modules" => [
"king" => 2,
"marriage" => 2,
"happyBirthday" => 2
]
],
[
"uid" => 8,
"id" => (-11111111),
"name" => "Only Human",
"on" => true,
"maintenance" => false,
"modules" => [
"king" => 2,
"marriage" => 2,
"happyBirthday" => 2
],
"modulesEnabled" => [
"log"=>false
]
],
]
]
];

View File

@ -1,50 +0,0 @@
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "BotChatLog" (
"id" INTEGER NOT NULL,
"personTelegramId" INTEGER,
"message" TEXT,
FOREIGN KEY("personTelegramId") REFERENCES "Users"("telegramId")
);
CREATE TABLE IF NOT EXISTS "UserGroupLink" (
"id" INTEGER NOT NULL UNIQUE,
"userId" INTEGER NOT NULL,
"groupId" INTEGER NOT NULL,
"firstSeen" INTEGER NOT NULL,
"lastSeen" INTEGER NOT NULL,
FOREIGN KEY("groupId") REFERENCES "Groups"("id"),
FOREIGN KEY("userId") REFERENCES "Users"("id"),
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "Groups" (
"id" INTEGER NOT NULL UNIQUE,
"telegramId" INTEGER NOT NULL UNIQUE,
"name" TEXT NOT NULL,
"username" TEXT,
"lastUpdate" INTEGER NOT NULL,
"creation" INTEGER NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "Users" (
"id" INTEGER NOT NULL UNIQUE,
"telegramId" INTEGER NOT NULL UNIQUE,
"name" TEXT NOT NULL,
"username" TEXT NOT NULL,
"privateChatStatus" TEXT NOT NULL,
"editAction" TEXT NOT NULL,
"optedOut" INTEGER NOT NULL DEFAULT 0,
"policyAccepted" INTEGER NOT NULL DEFAULT 0,
"lastUpdate" INTEGER NOT NULL,
"lastAccess" INTEGER,
"lastPrivateMessage" INTEGER NOT NULL DEFAULT 0,
"creation" INTEGER NOT NULL,
"uName" TEXT,
"ubirthDate" TEXT,
"ugender" TEXT,
"uorient" TEXT,
"uplace" TEXT,
"upvtChoice" TEXT,
"uRelationships" TEXT,
"uBio" TEXT,
PRIMARY KEY("id" AUTOINCREMENT)
);
COMMIT;

View File

@ -1,32 +0,0 @@
<?php
/**
* Holds a database instance
*/
class Database
{
private PDO $pdo;
public function __construct(PDO $pdo)
{
$this->pdo = $pdo;
}
/**
* Get the value of pdo
*/
public function getPdo()
{
return $this->pdo;
}
/**
* Set the value of pdo
*
* @return self
*/
public function setPdo($pdo)
{
$this->pdo = $pdo;
return $this;
}
}

View File

@ -1,734 +0,0 @@
<?php
require_once "common.php";
use TelegramBot\Api\Types\User;
/**
* A user in the database
*/
class DatabaseUser
{
private int $id, $telegramId;
private string $name, $username;
private string $privateChatStatus;
private string $editAction;
private bool $policyAccepted, $optedOut;
private int $lastUpdate, $lastAccess, $creation;
private int $lastPrivateMessage;
private Database $database;
private ?string $uName, $uGender, $uOrient, $uPlace, $upvtChoice, $uRelationships, $uBio;
private ?int $ubirthDate;
public function __construct(Database $database)
{
$this->database = $database;
}
public static function calcAge(int $unix): int
{
$tz = new DateTimeZone('Europe/Brussels');
return (int) DateTime::createFromFormat('U', $unix, $tz)
->diff(new DateTime('now', $tz))
->y;
}
public function getAge(): int
{
return self::calcAge($this->getUbirthDate());
}
/**
* Determines the appropriate flag
*/
public function getFlags(): array
{
$re = [];
$o = strtoupper($this->getUOrient() . " " . $this->getUGender() . " " . $this->getUPlace());
if (contains("LESB", $o)) $re[] = "lesbian";
if ("BI" == explode(" ", $o)[0]) $re[] = "bi";
if (contains("FLUID", $o)) $re[] = "fluid";
if (contains("ACE", $o)) $re[] = "asex";
if (contains("GENDERQ", $o)) $re[] = "gqueer";
if (contains("ARO", $o)) $re[] = "aro";
if (contains("ASE", $o)) $re[] = "asex";
if (contains("GAY", $o)) $re[] = "gay";
if (contains("BIS", $o)) $re[] = "bi";
if (contains("BSX", $o)) $re[] = "bi";
if (contains("PAN", $o)) $re[] = "pan";
if (contains("LELL", $o)) $re[] = "lesbian";
if (contains("OMNI", $o)) $re[] = "omni";
if (contains("QUESTIONING", $o)) $re[] = "questioning";
if (contains("DEMIS", $o)) $re[] = "demi";
if (contains("NB", $o) || contains("NON BINARY", $o)) $re[] = "nb";
if (contains("ETERO", $o) || contains("HET", $o)) $re[] = "etero";
if (contains("T4T", $o)) $re[] = "t4t";
//orientation, romantic
if (contains("BIROM", $o)) $re[] = "Biromantic";
if (contains("DEMIG", $o)) $re[] = "demigirl";
if (contains("MLM", $o)) $re[] = "mlm";
//gender-related
if (contains("MTF", $o) || contains("FTM", $o) || contains("TRANS", $o)) $re[] = "trans";
//miscellaneous
if (contains("FEMB", $o)) $re[] = "femboy";
if (contains("PIEMONTE", $o)) {
$re[] = "piemonte";
$re[] = "eu";
$re[] = "it";
}
if (contains("LOMBARDIA", $o)) {
$re[] = "lombardia";
$re[] = "eu";
$re[] = "it";
}
if (contains("VENETO", $o)) {
$re[] = "veneto";
$re[] = "eu";
$re[] = "it";
}
if (contains("FRIULI", $o)) {
$re[] = "friuli";
$re[] = "eu";
$re[] = "it";
}
if (contains("TRENTINO", $o)) {
$re[] = "trentino";
$re[] = "eu";
$re[] = "it";
}
if (contains("LIGURIA", $o)) {
$re[] = "liguria";
$re[] = "eu";
$re[] = "it";
}
if (contains("EMILIA", $o)) {
$re[] = "emilia";
$re[] = "eu";
$re[] = "it";
}
if (contains("AOSTA", $o)) {
$re[] = "valleAosta";
$re[] = "eu";
$re[] = "it";
}
if (contains("TOSCANIA", $o)) {
$re[] = "toscania";
$re[] = "eu";
$re[] = "it";
}
if (contains("MARCHE", $o)) {
$re[] = "marche";
$re[] = "eu";
$re[] = "it";
}
if (contains("ABRUZZO", $o)) {
$re[] = "abruzzo";
$re[] = "eu";
$re[] = "it";
}
if (contains("MOLISE", $o)) {
$re[] = "molise";
$re[] = "eu";
$re[] = "it";
}
if (contains("LAZIO", $o)) {
$re[] = "lazio";
$re[] = "eu";
$re[] = "it";
}
if (contains("CAMPANIA", $o)) {
$re[] = "campania";
$re[] = "eu";
$re[] = "it";
}
if (contains("BASILICATA", $o)) {
$re[] = "basilicata";
$re[] = "eu";
$re[] = "it";
}
if (contains("CALABRIA", $o)) {
$re[] = "calabria";
$re[] = "eu";
$re[] = "it";
}
if (contains("PUGLIA", $o)) {
$re[] = "puglia";
$re[] = "eu";
$re[] = "it";
}
if (contains("SICILIA", $o)) {
$re[] = "sicilia";
$re[] = "eu";
$re[] = "it";
}
if (contains("SARDEGNA", $o)) {
$re[] = "sardegna";
$re[] = "eu";
$re[] = "it";
}
if (contains("UMBRIA", $o)) {
$re[] = "umbria";
$re[] = "eu";
$re[] = "it";
}
if (contains("EU", $o)) $re[] = "eu";
if (contains("ITALIA", $o)) $re[] = "it";
if (contains("FRANCIA", $o)) $re[] = "fr";
if (contains("GERMANIA", $o)) $re[] = "de";
if (contains("SLOVENIA", $o)) $re[] = "slovenia";
return array_unique($re);
}
/**
* Get the value of id
*/
public function getId()
{
return $this->id;
}
/**
* Set the value of id
*
* @return self
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Get the value of telegramId
*/
public function getTelegramId()
{
return $this->telegramId;
}
/**
* Set the value of telegramId
*
* @return self
*/
public function setTelegramId($telegramId)
{
$this->telegramId = $telegramId;
return $this;
}
/**
* Get the value of name
*/
public function getName()
{
return $this->name;
}
/**
* Set the value of name
*
* @return self
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get the value of username
*/
public function getUsername()
{
return $this->username;
}
/**
* Set the value of username
*
* @return self
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Get the value of privateChatStatus
*/
public function getPrivateChatStatus()
{
return $this->privateChatStatus;
}
/**
* Set the value of privateChatStatus
*
* @return self
*/
public function setPrivateChatStatus($privateChatStatus)
{
$this->privateChatStatus = $privateChatStatus;
return $this;
}
/**
* Get the value of editAction
*/
public function getEditAction()
{
return $this->editAction;
}
/**
* Set the value of editAction
*
* @return self
*/
public function setEditAction($editAction)
{
$this->editAction = $editAction;
return $this;
}
/**
* Get the value of policyAccepted
*/
public function getPolicyAccepted()
{
return $this->policyAccepted;
}
/**
* Set the value of policyAccepted
*
* @return self
*/
public function setPolicyAccepted($policyAccepted)
{
$this->policyAccepted = $policyAccepted;
return $this;
}
/**
* Get the value of lastUpdate
*/
public function getLastUpdate()
{
return $this->lastUpdate;
}
/**
* Set the value of lastUpdate
*
* @return self
*/
public function setLastUpdate($lastUpdate)
{
$this->lastUpdate = $lastUpdate;
return $this;
}
/**
* Get the value of creation
*/
public function getCreation()
{
return $this->creation;
}
/**
* Set the value of creation
*
* @return self
*/
public function setCreation($creation)
{
$this->creation = $creation;
return $this;
}
/**
* Get the value of optedOut
*/
public function getOptedOut()
{
return $this->optedOut;
}
/**
* Set the value of optedOut
*
* @return self
*/
public function setOptedOut($optedOut)
{
$this->optedOut = $optedOut;
return $this;
}
public static function getByChat(Database $database, User $user): DatabaseUser
{
$q = $database->getPdo()->prepare("SELECT * FROM Users WHERE telegramId = :telegramId");
+$q->execute([":telegramId" => $user->getId()]);
$r = $q->fetch(PDO::FETCH_ASSOC);
if ($r == null) throw new NotFoundException();
$u = new DatabaseUser($database);
$u->setId((int) $r["id"]);
$u->setTelegramId((int) $r["telegramId"]);
$u->setName($r["name"]);
$u->setUsername($r["username"]);
$u->setPrivateChatStatus($r["privateChatStatus"]);
$u->setEditAction($r["editAction"]);
$u->setOptedOut((bool) $r["optedOut"]);
$u->setPolicyAccepted((bool) $r["policyAccepted"]);
$u->setLastUpdate((int) $r["lastUpdate"]);
$u->setCreation((int) $r["creation"]);
$u->setLastPrivateMessage((int) $r["lastPrivateMessage"]);
$u->setUName($r["uName"]);
$u->setUbirthDate($r["ubirthDate"]);
$u->setUGender($r["ugender"]);
$u->setUOrient($r["uorient"]);
$u->setUPlace($r["uplace"]);
$u->setUpvtChoice($r["upvtChoice"]);
$u->setURelationships($r["uRelationships"]);
$u->setUBio($r["uBio"]);
$u->poke($user);
return $u;
}
public static function create(Database $database, User $user): DatabaseUser
{
$u = new DatabaseUser($database); // TODO FINISH IMPLEMENTING
$u->setTelegramId($user->getId());
$u->setName($user->getFirstName() . " " . $user->getLastName());
$u->setUsername($user->getUsername());
$u->setPrivateChatStatus(PrivateChat::STATUS_ASK_DM);
$u->setEditAction("");
$u->setOptedOut(false);
$u->setPolicyAccepted(false);
$u->setLastUpdate(time());
$u->setCreation(time());
$u->setLastPrivateMessage(0);
$u->setUName(null);
$u->setUbirthDate(null);
$u->setUGender(null);
$u->setUOrient(null);
$u->setUPlace(null);
$u->setUpvtChoice(null);
$u->setURelationships(null);
$u->setUBio(null);
$u->save(true);
return $u;
}
public function setNULL(string $step): void
{
if ($step == PrivateChat::STATUS_ASK_NAME) $this->setUName(null);
if ($step == PrivateChat::STATUS_ASK_BIRTH) $this->setUbirthDate(null);
if ($step == PrivateChat::STATUS_ASK_GENDER) $this->setUGender(null);
if ($step == PrivateChat::STATUS_ASK_ORIENT) $this->setUOrient(null);
if ($step == PrivateChat::STATUS_ASK_WHERE) $this->setUPlace(null);
if ($step == PrivateChat::STATUS_ASK_PVT) $this->setUpvtChoice(null);
if ($step == PrivateChat::STATUS_ASK_REL) $this->setURelationships(null);
if ($step == PrivateChat::STATUS_ASK_BIO) $this->setUBio(null);
}
public function listUncompleted(): string
{
$list = "";
if (!$this->getUName()) $list .= "\n➡ Nome";
if (!$this->getUbirthDate()) $list .= "\n➡ Data di nascita";
if (!$this->getUGender()) $list .= "\n➡ Genere";
if (!$this->getUOrient()) $list .= "\n➡ Orientamento";
if (!$this->getUPlace()) $list .= "\n➡ Provenienza";
if (!$this->getUpvtChoice()) $list .= "\n➡ Messaggi privati";
if (!$this->getURelationships()) $list .= "\n➡ Relazioni";
if (!$this->getUBio()) $list .= "\n➡ Bio";
return $list;
}
public function countCompleted(): int
{
$tot = 0;
if ($this->getUName()) $tot++;
if ($this->getUbirthDate()) $tot++;
if ($this->getUGender()) $tot++;
if ($this->getUOrient()) $tot++;
if ($this->getUPlace()) $tot++;
if ($this->getUpvtChoice()) $tot++;
if ($this->getURelationships()) $tot++;
if ($this->getUBio()) $tot++;
return $tot;
}
public function poke(User $user): void
{
$this->setTelegramId($user->getId());
$this->setName($user->getFirstName() . " " . $user->getLastName());
$this->setUsername($user->getUsername());
$this->setLastAccess(time());
$this->save(false);
}
public function save(bool $isNew): void
{
$exec = [
":telegramId" => $this->getTelegramId(),
":name" => $this->getName(),
":username" => $this->getUsername(),
":privateChatStatus" => $this->getPrivateChatStatus(),
":editAction" => $this->getEditAction(),
":optedOut" => $this->getOptedOut(),
":policyAccepted" => $this->getPolicyAccepted(),
":lastUpdate" => time(),
":lastAccess" => time(),
":lastPrivateMessage" => $this->getLastPrivateMessage(),
":uName" => $this->getUName(),
":ubirthDate" => $this->getUbirthDate(),
":ugender" => $this->getuGender(),
":uorient" => $this->getUOrient(),
":uplace" => $this->getUPlace(),
":upvtChoice" => $this->getUpvtChoice(),
":uRelationships" => $this->getURelationships(),
":uBio" => $this->getUBio()
];
if (!$isNew) {
$q = $this->getDatabase()->getPdo()->prepare("UPDATE Users SET telegramId = :telegramId, name=:name, username=:username, privateChatStatus=:privateChatStatus, editAction=:editAction, optedOut=:optedOut, policyAccepted=:policyAccepted, lastUpdate=:lastUpdate, lastAccess=:lastAccess, lastPrivateMessage=:lastPrivateMessage, uName=:uName, ubirthDate=:ubirthDate, ugender=:ugender, uorient=:uorient, uplace=:uplace, upvtChoice=:upvtChoice, uRelationships=:uRelationships, uBio=:uBio WHERE telegramId=:telegramId");
$exec[":telegramId"] = $this->getTelegramId();
} else {
$q = $this->getDatabase()->getPdo()->prepare("INSERT INTO Users(telegramId, name, username, privateChatStatus, editAction, optedOut, policyAccepted, lastUpdate, lastAccess, lastPrivateMessage, creation, uName, ubirthDate, ugender, uorient, uplace, upvtChoice, uRelationships, uBio) VALUES(:telegramId, :name, :username, :privateChatStatus, :editAction, :optedOut, :policyAccepted, :lastUpdate, :lastAccess, :lastPrivateMessage, :creation, :uName, :ubirthDate, :ugender, :uorient, :uplace, :upvtChoice, :uRelationships, :uBio)");
$exec[":creation"] = time();
}
$q->execute($exec);
}
/**
* Get the value of lastAccess
*/
public function getLastAccess()
{
return $this->lastAccess;
}
/**
* Set the value of lastAccess
*
* @return self
*/
public function setLastAccess($lastAccess)
{
$this->lastAccess = $lastAccess;
return $this;
}
/**
* Get the value of database
*/
public function getDatabase()
{
return $this->database;
}
/**
* Set the value of database
*
* @return self
*/
public function setDatabase($database)
{
$this->database = $database;
return $this;
}
/**
* Get the value of lastPrivateMessage
*/
public function getLastPrivateMessage()
{
return $this->lastPrivateMessage;
}
/**
* Set the value of lastPrivateMessage
*
* @return self
*/
public function setLastPrivateMessage($lastPrivateMessage)
{
$this->lastPrivateMessage = $lastPrivateMessage;
return $this;
}
/**
* Get the value of uName
*/
public function getUName()
{
return $this->uName;
}
/**
* Set the value of uName
*
* @return self
*/
public function setUName($uName)
{
$this->uName = $uName;
return $this;
}
/**
* Get the value of ubirthDate
*/
public function getUbirthDate()
{
return $this->ubirthDate;
}
/**
* Set the value of ubirthDate
*
* @return self
*/
public function setUbirthDate($ubirthDate)
{
$this->ubirthDate = $ubirthDate;
return $this;
}
/**
* Get the value of uGender
*/
public function getUGender()
{
return $this->uGender;
}
/**
* Set the value of uGender
*
* @return self
*/
public function setUGender($uGender)
{
$this->uGender = $uGender;
return $this;
}
/**
* Get the value of uOrient
*/
public function getUOrient()
{
return $this->uOrient;
}
/**
* Set the value of uOrient
*
* @return self
*/
public function setUOrient($uOrient)
{
$this->uOrient = $uOrient;
return $this;
}
/**
* Get the value of uPlace
*/
public function getUPlace()
{
return $this->uPlace;
}
/**
* Set the value of uPlace
*
* @return self
*/
public function setUPlace($uPlace)
{
$this->uPlace = $uPlace;
return $this;
}
/**
* Get the value of upvtChoice
*/
public function getUpvtChoice()
{
return $this->upvtChoice;
}
/**
* Set the value of upvtChoice
*
* @return self
*/
public function setUpvtChoice($upvtChoice)
{
$this->upvtChoice = $upvtChoice;
return $this;
}
/**
* Get the value of uRelationships
*/
public function getURelationships()
{
return $this->uRelationships;
}
/**
* Set the value of uRelationships
*
* @return self
*/
public function setURelationships($uRelationships)
{
$this->uRelationships = $uRelationships;
return $this;
}
/**
* Get the value of uBio
*/
public function getUBio()
{
return $this->uBio;
}
/**
* Set the value of uBio
*
* @return self
*/
public function setUBio($uBio)
{
$this->uBio = $uBio;
return $this;
}
}

View File

@ -1,207 +0,0 @@
<?php
use TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Client;
class Group
{
private int $id;
private int $telegramId;
private string $name, $username;
private int $lastUpdate, $creation;
public static function listAll(Database $database): array
{
$list = [];
$q = $database->getPdo()->prepare("SELECT * FROM Groups");
$q->execute();
while ($r = $q->fetch(PDO::FETCH_ASSOC)) {
$g = new Group();
$g->setId((int) $r["id"]);
$g->setTelegramId((int) $r["telegramId"]);
$g->setName((string) $r["name"]);
$g->setUsername((string) $r["username"]);
$g->setLastUpdate((int) $r["lastUpdate"]);
$g->setCreation((int) $r["creation"]);
$list[] = $g;
}
return $list;
}
public static function poke(Database $database, Message $message, DatabaseUser $du): array
{
$res = [];
$group = $message->getChat();
$q = $database->getPdo()->prepare("SELECT id FROM Groups WHERE telegramId=:telegramId");
$q->execute([":telegramId" => $group->getId()]);
$r = $q->fetch(PDO::FETCH_ASSOC);
if ($r) {
$q = $database->getPdo()->prepare("UPDATE Groups SET telegramId=:telegramId, name=:name, username=:username, lastUpdate=:lastUpdate WHERE id=:id");
$q->execute([
":telegramId" => $group->getId(),
":name" => $group->getTitle(),
":username" => $group->getUsername(),
":lastUpdate" => time(),
":id" => $r["id"]
]);
$res[] = false;
} else {
$q = $database->getPdo()->prepare("INSERT INTO Groups(telegramId, name, username, lastUpdate, creation) VALUES(:telegramId, :name, :username, :lastUpdate, :creation)");
$q->execute([
":telegramId" => $group->getId(),
":name" => $group->getTitle(),
":username" => $group->getUsername(),
":lastUpdate" => time(),
":creation" => time()
]);
$res[] = true;
}
$q = $database->getPdo()->prepare("SELECT * FROM UserGroupLink WHERE groupId=:groupId AND userId=:userId");
$q->execute([":groupId" => $group->getId(), ":userId" => $message->getFrom()->getId()]);
$r = $q->fetch(PDO::FETCH_ASSOC);
if ($r) {
$q = $database->getPdo()->prepare("UPDATE UserGroupLink SET userId=:userId, groupId=:groupId, lastSeen=:lastSeen WHERE id=:id");
$q->execute([
":userId" => $message->getFrom()->getId(),
":groupId" => $group->getId(),
":lastSeen" => time(),
":id" => $r["id"]
]);
$res[] = false;
} else {
$q = $database->getPdo()->prepare("INSERT INTO UserGroupLink(userId, groupId, firstSeen, lastSeen) VALUES(:userId, :groupId, :firstSeen, :lastSeen)");
$q->execute([
":userId" => $message->getFrom()->getId(),
":groupId" => $group->getId(),
":firstSeen" => time(),
":lastSeen" => time()
]);
if ($du->getPrivateChatStatus() == PrivateChat::STATUS_EXCLUDED) $res[] = false;
else $res[] = true;
}
return $res;
}
/**
* Get the value of id
*/
public function getId()
{
return $this->id;
}
/**
* Set the value of id
*
* @return self
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Get the value of telegramId
*/
public function getTelegramId()
{
return $this->telegramId;
}
/**
* Set the value of telegramId
*
* @return self
*/
public function setTelegramId($telegramId)
{
$this->telegramId = $telegramId;
return $this;
}
/**
* Get the value of name
*/
public function getName()
{
return $this->name;
}
/**
* Set the value of name
*
* @return self
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get the value of username
*/
public function getUsername()
{
return $this->username;
}
/**
* Set the value of username
*
* @return self
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Get the value of lastUpdate
*/
public function getLastUpdate()
{
return $this->lastUpdate;
}
/**
* Set the value of lastUpdate
*
* @return self
*/
public function setLastUpdate($lastUpdate)
{
$this->lastUpdate = $lastUpdate;
return $this;
}
/**
* Get the value of creation
*/
public function getCreation()
{
return $this->creation;
}
/**
* Set the value of creation
*
* @return self
*/
public function setCreation($creation)
{
$this->creation = $creation;
return $this;
}
}

View File

@ -1,2 +0,0 @@
<?php
class NotFoundException extends Exception{}

87
eva.php
View File

@ -1,87 +0,0 @@
<?php
function evaSplit($text)
{
$text = chunk_split($text, 38, "\n");
$list = explode("\n", $text);
array_filter($list);
$f = "";
foreach ($list as $el) {
$f .= htmlentities(trim($el)) . "<br />";
}
return $f;
}
$data = json_decode($_GET["data"]);
if ($data == null) {
?>
<header class="eva-heading">
<h2 class="eva-heading__title">NEON</h2>
<h2 class="eva-heading__title">GENESIS</h2>
<h1 class="eva-heading__title">EVANGELION</h1>
<h3 class="eva-heading__episode-number">EPISODE: YES</h3>
<h4 class="eva-heading__episode-title">
Application Error, call NERV
</h4>
</header>
<?php
} else {
?>
<header class="eva-heading">
<h2 class="eva-heading__title"><?php echo htmlentities($data[0]); ?></h2>
<h2 class="eva-heading__title"><?php echo htmlentities($data[1]); ?></h2>
<h1 class="eva-heading__title"><?php echo htmlentities($data[2]); ?></h1>
<h3 class="eva-heading__episode-number"><?php echo htmlentities($data[3]); ?></h3>
<h4 class="eva-heading__episode-title">
<?php echo evaSplit($data[4]); ?>
</h4>
</header>
<?php
}
?>
<style>
* {
margin: 0;
padding: 0;
}
body {
background-color: black;
}
.eva-heading {
padding: 32px;
align-self: baseline;
font-family: serif;
color: white;
text-shadow: 0 0 2px #e19a86, 0 0 1.5px #854535, 0 0 1.5px #5c150c;
width: 600px;
height: 478px;
}
.eva-heading>h1 {
font-size: 500%;
}
.eva-heading>h2 {
font-size: 300%;
}
.eva-heading__title {
transform: scale(1, 1.5);
line-height: 1.2em;
letter-spacing: -.03em;
}
.eva-heading__episode-number {
font-family: sans-serif;
font-size: 180%;
transform: scale(1, 1.5);
letter-spacing: -.06em;
margin: 10px 0 26px 0;
}
.eva-heading__episode-title {
transform: scale(1, 1.3);
font-size: 170%;
line-height: 1em;
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 686 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 KiB

View File

@ -1,97 +0,0 @@
<?php
use \TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Types\User;
use \TelegramBot\Api\Client;
use \TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
class Card extends Command
{
private Database $database;
private ?User $user;
public static function exposedCommands(): array
{
return [];
}
public function __construct(Message $message, Client $bot, Database $database, ?User $user = null)
{
parent::__construct($message, $bot);
$this->database = $database;
$this->user = $user;
}
public function execute(): void
{
if (!$this->replyUser) $this->replyUser = $this->message->getFrom();
$m = $this->message->getReplyToMessage();
if (!$m) {
$this->sendCard($this->message->getFrom(), $this->message->getChat()->getId(), $this->message->getMessageId());
} else {
$this->sendCard($m->getFrom(), $m->getChat()->getId(), $m->getMessageId());
}
}
public function viewPVC(DatabaseUser $du)
{
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->user->getId(),
$du->getLastPrivateMessage()
);
$keyboard = new InlineKeyboardMarkup([
[
['text' => "✅ Ok", 'callback_data' => 'endSet#save']
]
]);
$m = $this->sendCard($this->user, $this->user->getId(), null, $keyboard);
$du->setLastPrivateMessage($m->getMessageId());
$du->setPrivateChatStatus(PrivateChat::STATUS_VIEWING_CARD);
$du->save(false);
}
public function sendCard(User $u, int $chatId, ?int $replyTo = null, $keyboard = null)
{
$du = DatabaseUser::getByChat($this->database, $u);
if ($du->getPrivateChatStatus() != PrivateChat::STATUS_ENDED && $du->getPrivateChatStatus() != PrivateChat::STATUS_VIEWING_CARD) {
$message = $this->bot->sendMessage($chatId, "L'utente non ha ancora impostato i suoi dati o li sta modificando.", "HTML", false, $replyTo, $keyboard);
$du->setPrivateChatStatus(PrivateChat::STATUS_ENDED);
return $message;
}
if ($du->countCompleted() == 0) {
$message = $this->bot->sendMessage($chatId, "Non ci sono dati", "HTML", false, $replyTo, $keyboard);
$du->setPrivateChatStatus(PrivateChat::STATUS_ENDED);
return $message;
}
$ps = $this->bot->getUserProfilePhotos($u->getId())->getPhotos();
$firstPhoto = $ps[0];
$biggest = $firstPhoto[count($firstPhoto) - 1];
$path = $this->bot->getFile($biggest->getFileId())->getFilePath();
$url = "https://api.telegram.org/file/bot" . $GLOBALS["token"] . "/" . $path;
$data = [
"name" => $du->getUName(),
"birth" => $du->getUbirthDate(),
"gender" => $du->getUGender(),
"orientation" => $du->getUOrient(),
"where" => $du->getUPlace(),
"pvt" => $du->getUpvtChoice(),
"rel" => $du->getURelationships(),
"flags" => $du->getFlags(),
"isDev" => $du->getTelegramId() == $GLOBALS["masterId"],
"img" => $url,
"nonce" => bin2hex(random_bytes(16))
];
$height = 480 + floor(count($du->getFlags()) / 5) * 100;
$url = $GLOBALS["imageServer"] . "?access_key=" . $GLOBALS["urltoimagekey"] . "&url=" . $GLOBALS["baseurl"] . "/card.php%3Fdata%3D" . urlencode(json_encode($data)) . "&height=$height&width=600";
$this->bot->sendChatAction($this->message->getChat()->getId(), "upload_photo");
try {
$message = $this->bot->sendPhoto(
$chatId,
$url,
"",
$replyTo,
$keyboard,
null,
"HTML"
);
} catch (\TelegramBot\Api\Exception $e) {
$message = $this->bot->sendMessage($chatId, "Non è stato possibile generare l'immagine", "HTML", false, $replyTo, $keyboard);
}
return $message;
}
}

View File

@ -1,33 +0,0 @@
<?php
use \TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Client;
class Command
{
protected $message; // Message
protected $bot; // Client
public function __construct(Message $message, Client $bot)
{
$this->message = $message;
$this->bot = $bot;
}
protected function multiExplode(string $string, array $delimiters, int $max = -1): array
{
$l = [];
$temp = "";
$found = 0;
foreach (str_split($string) as $char) {
if (in_array($char, $delimiters)) {
if ($max != -1 && $found == $max) break;
$l[] = $temp;
$temp = "";
$found++;
}
}
return $l;
}
public function execute(): void{
}
}

View File

@ -1,42 +0,0 @@
<?php
use \TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Client;
class Eva extends Command
{
public static function exposedCommands(): array
{
return [];
}
public function __construct(Message $message, Client $bot)
{
parent::__construct($message, $bot);
}
public function execute(): void
{
$remaining = PictureAPIRateLimitHandler::countAdd();
if ($remaining->getFinished() == CountAddResult::FINISHED_TODAY) {
$message = $this->bot->sendMessage($this->message->getChat()->getId(), "È stato raggiunto il numero massimo di immagini giornaliero (" . $remaining->getDailyLimit() . ")", "HTML", false);
} elseif ($remaining->getFinished() == CountAddResult::FINISHED_UNTIL_RENEW) {
$message = $this->bot->sendMessage($this->message->getChat()->getId(), "È stato raggiunto il numero massimo di immagini ( stop fino a " . date("d/m/Y H:i:s", $remaining->getReset()) . ")", "HTML", false);
} else {
$m = $this->message->getReplyToMessage();
if (!$m) {
$this->bot->sendMessage($this->message->getChat()->getId(), "Cita un messaggio di testo", null, false, $this->message->getMessageId());
} else {
$url = "https://api.apiflash.com/v1/urltoimage?access_key=" . $GLOBALS["urltoimagekey"] . "&url=" . $GLOBALS["baseurl"] . "/eva.php%3Fdata%3D" . urlencode(json_encode(explode("\n", $m->getText()))) . "&height=478&width=600";
$this->bot->sendChatAction($this->message->getChat()->getId(), "upload_photo");
$this->bot->sendPhoto(
$this->message->getChat()->getId(),
$url,
$remaining->getRemainingToday() . " immagini rimanenti oggi",
$this->message->getMessageId(),
null,
null,
"HTML"
);
}
}
}
}

View File

@ -1,87 +0,0 @@
<?php
require_once "common.php";
use \TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Types\User;
use \TelegramBot\Api\Client;
use \TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
class Explain extends Command
{
private Database $database;
private ?User $user;
public static function exposedCommands(): array
{
return [];
}
public function __construct(Message $message, Client $bot, Database $database, ?User $user = null)
{
parent::__construct($message, $bot);
$this->database = $database;
$this->user = $user;
}
public static function toText(DatabaseUser $du): string
{
if ($du->getPrivateChatStatus() != PrivateChat::STATUS_ENDED && $du->getPrivateChatStatus() != PrivateChat::STATUS_VIEWING_CARD) {
return "L'utente non ha ancora impostato i suoi dati o li sta modificando.";
}
$text = "Provo a spiegare:\n";
$name = $du->getUName() ?: $du->getName();
$g = strtoupper($du->getUGender());
$o = strtoupper($du->getUOrient());
if (contains("TRANS", $g) || contains("MTF", $g) || contains("FTM", $g)) $text .= "\n$name è transgender, questo significa che la sua identità di genere (autopercezione del genere) diverge dal suo sesso biologico.";
if (contains("FTM", $g)) $text .= "\nNello specifico il genere percepito da $name è Maschile.";
if (contains("MTF", $g)) $text .= "\nNello specifico il genere percepito da $name è Femmnile.";
if (contains("UOMO", $g)) $text .= "\n$name si percepisce come uomo.";
if (contains("DONNA", $g)) $text .= "\n$name si percepisce come donna.";
if (contains("NON-BINARY", $g)) $text .= "\n$name si percepisce come non-binary (non-binario).\nLa sua identità di genere (genere autopercepito) è al di fuori del cosiddetto binarismo di genere, ovvero non strettamente e/o completamente maschile o femminile.";
if (contains("DEMIBOY", $g)) $text .= "\n$name si percepisce come parzialmente come uomo (demiboy).";
if (contains("DEMIGIRL", $g)) $text .= "\n$name si percepisce come parzialmente come donna (demigirl).";
if (contains("GENDERQUEER", $g)) $text .= "\n$name si percepisce come genderqueer, ovvero in una relazione non-normata rispetto al proprio genere.";
if (contains("ETERO", $o)) $text .= "\n$name è eterosessuale, ovvero sperimenta attrazione verso persone del genere opposto.";
if (contains("GAY", $o)) $text .= "\n$name è gay, ovvero sperimenta attrazione verso persone dello stesso genere.";
if (contains("LESBICA", $o)) $text .= "\n$name è lesbica, ovvero sperimenta attrazione verso persone dello stesso genere.";
if (contains("ASESSUALE", $o)) $text .= "\n$name è asessuale, ovvero non sperimenta attrazione.";
if (contains("PANSESSUALE", $o)) $text .= "\n$name è pansessuale, ovvero sperimenta attrazione verso persone di tutti i generi.";
if (contains("BISESSUALE", $o)) $text .= "\n$name è bisessuale, ovvero sperimenta attrazione verso persone di tutti i generi.";
if (contains("DEMISESSUALE", $o)) $text .= "\n$name è demisessuale, ovvero sperimenta attrazione solo verso persone con cui ha un forte legame emotivo.";
if (contains("QUESTIONING", $o)) $text .= "\n$name è questioning, ovvero sta comprendendo e/o esplorando la propria sessualità.";
if ($text == "Provo a spiegare:\n") $text = "Non ho dati sufficienti o conformi al mio database per spiegare";
return $text;
}
public function execute(): void
{
if (!$this->replyUser) $this->replyUser = $this->message->getFrom();
$m = $this->message->getReplyToMessage();
if (!$m) {
$du = DatabaseUser::getByChat($this->database, $this->message->getFrom());
$this->bot->sendMessage($this->message->getChat()->getId(), self::toText($du), "HTML", false, $this->message->getMessageId());
} else {
$du = DatabaseUser::getByChat($this->database, $m->getFrom());
$this->bot->sendMessage($m->getChat()->getId(), self::toText($du), "HTML", false, $m->getMessageId());
}
}
public function pvtLookup(DatabaseUser $du)
{
if ($du->getLastPrivateMessage() != 0) {
try {
$this->bot->deleteMessage(
$this->user->getId(),
$du->getLastPrivateMessage()
);
} catch (\TelegramBot\Api\Exception $e) {
}
}
$keyboard = new InlineKeyboardMarkup([
[
['text' => "✅ Ok", 'callback_data' => 'endSet#save']
]
]);
$message = $this->bot->sendMessage($this->user->getId(), self::toText($du), "HTML", false, null, $keyboard);
$du->setLastPrivateMessage($message->getMessageId());
$du->setPrivateChatStatus(PrivateChat::STATUS_VIEWING_CARD);
$du->save(false);
}
}

View File

@ -1,65 +0,0 @@
<?php
use \TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Client;
class Flip extends Command
{
const VERTICAL = 0;
const HORIZONTAL = 1;
const BOTH = 2;
public static function exposedCommands(): array
{
return [];
}
private int $mode;
public function __construct(Message $message, Client $bot, int $mode)
{
parent::__construct($message, $bot);
$this->mode = $mode;
}
public function execute(): void
{
$m = $this->message->getReplyToMessage();
if (!$m) {
$this->bot->sendMessage($this->message->getChat()->getId(), "Cita una foto (nessun messaggio citato)", null, false, $this->message->getMessageId());
} else {
$p = $m->getPhoto();
if (!$p) {
$this->bot->sendMessage($this->message->getChat()->getId(), "Cita una foto (non hai citato una foto)", null, false, $this->message->getMessageId());
} else {
$biggest = $p[count($p) - 1];
$path = $this->bot->getFile($biggest->getFileId())->getFilePath();
$url = "https://api.telegram.org/file/bot" . $GLOBALS["token"] . "/" . $path;
if (!file_exists('tempImageProcessing')) {
mkdir('tempImageProcessing');
}
$io = bin2hex(random_bytes(10));
$filename = "tempImageProcessing/" . $io . ".jpg";
$ch = curl_init($url);
$fp = fopen($filename, 'wb+');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
$im = imagecreatefromjpeg($filename);
if ($this->mode == self::VERTICAL || $this->mode == self::BOTH) imageflip($im, IMG_FLIP_VERTICAL);
if ($this->mode == self::HORIZONTAL || $this->mode == self::BOTH) imageflip($im, IMG_FLIP_HORIZONTAL);
if ($this->mode == self::VERTICAL) $text = "Rovesciato in <b>Verticale</b>";
if ($this->mode == self::HORIZONTAL) $text = "Rovesciato in <b>Orizzontale</b>";
if ($this->mode == self::BOTH) $text = "Rovesciato in <b>Orizzontale e Verticale</b>";
imagejpeg($im, $filename);
$this->bot->sendChatAction($this->message->getChat()->getId(), "upload_photo");
$this->bot->sendPhoto(
$this->message->getChat()->getId(),
$GLOBALS["baseurl"] . "/tempImageProcessing/getter.php?photo=" . $io,
$text,
$this->message->getMessageId(),
null,
null,
"HTML"
);
}
}
}
}

View File

@ -1,56 +0,0 @@
<?php
use TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Client;
use \TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
class GroupWatcher
{
public static function watch(Database $database, Message $message, Client $bot): void
{
$isNew = false;
try {
$du = DatabaseUser::getByChat($database, $message->getFrom());
if ($du->getPrivateChatStatus() == PrivateChat::STATUS_STRAY_USER) {
self::createMessageStray($database, $message, $bot);
$du->setPrivateChatStatus(PrivateChat::STATUS_ASK_DM);
}
$du->save(false);
} catch (NotFoundException $e) {
$isNew = true;
self::createMessageNormal($database, $message, $bot);
$du = DatabaseUser::create($database, $message->getFrom());
$du->setPrivateChatStatus(PrivateChat::STATUS_ASK_DM);
$du->poke($message->getFrom());
}
$r = Group::poke($database, $message, $du);
$shouldSendSeen = $r[1];
$shouldSendNewGroup = $r[0];
if ($shouldSendSeen && !$isNew) $bot->sendMessage($message->getChat()->getId(), "Benvenutə, ti ho già visto in precedenza.\n" . Lookup::toText($du), "HTML", false, $message->getMessageId());
if ($shouldSendNewGroup) $bot->sendMessage($message->getChat()->getId(), "Sono in un nuovo gruppo! yay. Ricordatevi di darmi accesso ai messaggi per accogliere i nuovi arrivati.", "HTML", false, $message->getMessageId());
if ($shouldSendNewGroup) $bot->sendMessage($GLOBALS["logId"], "Sono in un nuovo gruppo! " . $message->getChat()->getTitle() . "(@" . $message->getChat()->getUsername() . ")", "HTML", false);
}
public static function getCommonKeyboard(): InlineKeyboardMarkup
{
return $keyboard = new InlineKeyboardMarkup([
[
['text' => "✏️ Compila", 'url' => 'https://t.me/' . $GLOBALS["username"]],
['text' => "❓ Cosa fa questo bot?", 'callback_data' => 'whatIsThis'],
['text' => "🚫 Escludimi dal bot", 'url' => 'https://t.me/' . $GLOBALS["username"]]
]
]);
}
public static function createMessageNormal(Database $database, Message $message, Client $bot): void
{
$keyboard = self::getCommonKeyboard();
$bot->sendMessage($message->getChat()->getId(), "Benvenutə, questo bot gestisce un sistema di profili su questo ed altri gruppi!", null, false, $message->getMessageId(), $keyboard);
}
public static function createMessageStray(Database $database, Message $message, Client $bot): void
{
$keyboard = self::getCommonKeyboard();
$bot->sendMessage($message->getChat()->getId(), "Benvenutə!\n Mi avevi scritto prima di entrare in un gruppo in cui c'ero e non potevo creare il profilo, ma ora posso.\n Questo bot gestisce un sistema di profili su questo ed altri gruppi!", null, false, $message->getMessageId(), $keyboard);
}
}

View File

@ -1,31 +0,0 @@
<?php
use \TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Client;
class Inspire extends Command
{
public static function exposedCommands(): array
{
return [];
}
public function __construct(Message $message, Client $bot)
{
parent::__construct($message, $bot);
}
public function execute(): void
{
$url = file_get_contents("https://inspirobot.me/api?generate=true");
$this->bot->sendChatAction($this->message->getChat()->getId(), "upload_photo");
$this->bot->sendPhoto(
$this->message->getChat()->getId(),
$url,
null,
$this->message->getMessageId(),
null,
null,
"HTML"
);
}
}

View File

@ -1,73 +0,0 @@
<?php
require_once "common.php";
use \TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Types\User;
use \TelegramBot\Api\Client;
use \TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
class Lookup extends Command
{
private Database $database;
private ?User $user;
public static function exposedCommands(): array
{
return [];
}
public function __construct(Message $message, Client $bot, Database $database, ?User $user = null)
{
parent::__construct($message, $bot);
$this->database = $database;
$this->user = $user;
}
public static function toText(DatabaseUser $du): string
{
if ($du->getPrivateChatStatus() != PrivateChat::STATUS_ENDED && $du->getPrivateChatStatus() != PrivateChat::STATUS_VIEWING_CARD) {
return "L'utente non ha ancora impostato i suoi dati o li sta modificando.";
}
$text = "";
if ($du->getUName()) $text .= "\n\n<b>Nome</b>: \n" . $du->getUName();
if ($du->getUbirthDate()) $text .= "\n\n<b>Data di Nascita</b>: \n" . itdate($du->getUbirthDate()) . " (" . DatabaseUser::calcAge($du->getUbirthDate()) . " anni)";
if ($du->getUGender()) $text .= "\n\n<b>Genere</b>: \n" . $du->getUGender();
if ($du->getUOrient()) $text .= "\n\n<b>Orientamento</b>: \n" . $du->getUOrient();
if ($du->getUPlace()) $text .= "\n\n<b>Provenienza</b>: \n" . $du->getUPlace();
if ($du->getURelationships()) $text .= "\n\n<b>Relazioni</b>: \n" . $du->getURelationships();
if ($du->getUBio()) $text .= "\n\n<b>Bio</b>: \n" . $du->getUBio();
if (strlen($text) == 0) $text = "Non ci sono dati";
return $text;
}
public function execute(): void
{
if (!$this->replyUser) $this->replyUser = $this->message->getFrom();
$m = $this->message->getReplyToMessage();
if (!$m) {
$du = DatabaseUser::getByChat($this->database, $this->message->getFrom());
$this->bot->sendMessage($this->message->getChat()->getId(), self::toText($du), "HTML", false, $this->message->getMessageId());
} else {
$du = DatabaseUser::getByChat($this->database, $m->getFrom());
$this->bot->sendMessage($m->getChat()->getId(), self::toText($du), "HTML", false, $m->getMessageId());
}
}
public function pvtLookup(DatabaseUser $du)
{
if ($du->getLastPrivateMessage() != 0) {
try {
$this->bot->deleteMessage(
$this->user->getId(),
$du->getLastPrivateMessage()
);
} catch (\TelegramBot\Api\Exception $e) {
}
}
$keyboard = new InlineKeyboardMarkup([
[
['text' => "✅ Ok", 'callback_data' => 'endSet#save']
]
]);
$message = $this->bot->sendMessage($this->user->getId(), self::toText($du), "HTML", false, null, $keyboard);
$du->setLastPrivateMessage($message->getMessageId());
$du->setPrivateChatStatus(PrivateChat::STATUS_VIEWING_CARD);
$du->save(false);
}
}

View File

@ -1,788 +0,0 @@
<?php
use \TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Client;
use \TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
use \TelegramBot\Api\Types\User;
//Change Users Class and fb to store all user data in one table
class PrivateChat extends Command
{
const STATUS_ASK_DM = "askDm";
const STATUS_CONSENT = "consent";
const STATUS_ASK_NAME = "askName";
const STATUS_ASK_BIRTH = "askBirth";
const STATUS_ASK_GENDER = "askGender";
const STATUS_ASK_ORIENT = "askOrient";
const STATUS_ASK_WHERE = "askWhere";
const STATUS_ASK_PVT = "askPVT";
const STATUS_ASK_REL = "askrel";
const STATUS_ASK_BIO = "askBio";
const STATUS_EDITING = "edit";
const STATUS_STRAY_USER = "stray";
const STATUS_EXCLUDED = "exclude";
const STATUS_NOT_CONSENT = "notConsent";
const STATUS_ENDED = "ended";
const STATUS_VIEWING_CARD = "card";
const STATUS_MESSAGE_SEND = "msgsend";
private Database $database;
public static function exposedCommands(): array
{
return [];
}
private ?User $replyUser;
public function __construct(Message $message, Client $bot, Database $database, User $replyUser = null)
{
parent::__construct($message, $bot);
$this->database = $database;
$this->replyUser = $replyUser;
}
public function execute(bool $mustSet = true): void
{
if (!$this->replyUser) $this->replyUser = $this->message->getFrom();
try {
$du = DatabaseUser::getByChat($this->database, $this->replyUser);
switch ($du->getPrivateChatStatus()) {
case self::STATUS_ASK_DM:
$keyboard = new InlineKeyboardMarkup([
[
['text' => "✅ Acconsento", 'callback_data' => 'yesPolicy'],
['text' => "❌ Non Acconsento", 'callback_data' => 'noPolicy']
],
[
['text' => "🚫 Escludimi dal bot", 'callback_data' => "excludeMe"]
]
]);
$message = $this->bot->sendMessage($this->replyUser->getId(), "Per procedere, occorre acconsentire alla <a href=\"https://telegra.ph/Rainbow-Bot----Privacy-policy-08-04\">Privacy Policy</a>", "HTML", false, null, $keyboard);
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$du->setOptedOut(false);
$du->setLastPrivateMessage($message->getMessageId());
$du->poke($this->replyUser);
break;
case self::STATUS_STRAY_USER:
throw new NotFoundException(); // trigger stray user message
break;
case self::STATUS_ASK_NAME:
if ($mustSet) $du->setUName(ellipses($this->message->getText()));
$du->save(false);
$this->askName($du);
try {
if ($mustSet) $this->bot->deleteMessage(
$this->replyUser->getId(),
$this->message->getMessageId()
);
} catch (\TelegramBot\Api\Exception $e) {
}
break;
case self::STATUS_ASK_BIRTH:
$text = $this->message->getText();
$text = str_replace("-", "/", $text);
$text = str_replace(".", "/", $text);
$e = explode("/", $text);
$builtDate = strtotime($e[2] . "-" . $e[1] . "-" . $e[0]);
if ($mustSet) {
if (!ctype_digit($e[0])) $invalid = true;
elseif (!ctype_digit($e[1])) $invalid = true;
elseif (!ctype_digit($e[2])) $invalid = true;
else $invalid = !checkdate((int) $e[1], (int) $e[0], (int) $e[2]);
if (!$invalid) $du->setUbirthDate($builtDate);
} else {
$invalid = false;
}
$du->save(false);
$this->askBirthDate($du, $invalid);
try {
if ($mustSet) $this->bot->deleteMessage(
$this->replyUser->getId(),
$this->message->getMessageId()
);
} catch (\TelegramBot\Api\Exception $e) {
}
break;
case self::STATUS_ASK_GENDER:
if ($mustSet) $du->setUGender(ellipses($this->message->getText()));
$du->save(false);
$this->askGender($du);
try {
if ($mustSet) $this->bot->deleteMessage(
$this->replyUser->getId(),
$this->message->getMessageId()
);
} catch (\TelegramBot\Api\Exception $e) {
}
break;
case self::STATUS_ASK_ORIENT:
if ($mustSet) $du->setUOrient(ellipses($this->message->getText()));
$du->save(false);
$this->askOrient($du);
try {
if ($mustSet) $this->bot->deleteMessage(
$this->replyUser->getId(),
$this->message->getMessageId()
);
} catch (\TelegramBot\Api\Exception $e) {
}
break;
case self::STATUS_ASK_WHERE:
if ($mustSet) $du->setUPlace(ellipses($this->message->getText()));
$du->save(false);
$this->askWhere($du);
try {
if ($mustSet) $this->bot->deleteMessage(
$this->replyUser->getId(),
$this->message->getMessageId()
);
} catch (\TelegramBot\Api\Exception $e) {
}
break;
case self::STATUS_ASK_PVT:
if ($mustSet) $du->setUpvtChoice(ellipses($this->message->getText()));
$du->save(false);
$this->askPVT($du);
try {
if ($mustSet) $this->bot->deleteMessage(
$this->replyUser->getId(),
$this->message->getMessageId()
);
} catch (\TelegramBot\Api\Exception $e) {
}
break;
case self::STATUS_ASK_REL:
if ($mustSet) $du->setURelationships(ellipses($this->message->getText()));
$du->save(false);
$this->askRel($du);
try {
if ($mustSet) $this->bot->deleteMessage(
$this->replyUser->getId(),
$this->message->getMessageId()
);
} catch (\TelegramBot\Api\Exception $e) {
}
break;
case self::STATUS_ASK_BIO:
if ($mustSet) $du->setUBio(ellipses($this->message->getText(), 500));
$du->save(false);
$this->askBio($du);
try {
if ($mustSet) $this->bot->deleteMessage(
$this->replyUser->getId(),
$this->message->getMessageId()
);
} catch (\TelegramBot\Api\Exception $e) {
}
break;
case self::STATUS_ENDED:
$this->completedMenu();
/*$this->bot->deleteMessage(
$this->replyUser->getId(),
$this->message->getMessageId()
);*/
break;
case self::STATUS_EXCLUDED:
$this->excludeYes();
break;
case self::STATUS_NOT_CONSENT:
$this->noPolicy();
case self::STATUS_MESSAGE_SEND:
$this->sendMessageToGroups($this->message->getText());
break;
}
} catch (NotFoundException $e) {
$message = $this->bot->sendMessage($this->replyUser->getId(), "Per usare questo bot devi avere prima partecipato ad un gruppo a cui appartiene.", "HTML", false);
$du = DatabaseUser::create($this->database, $this->replyUser);
$du->setPrivateChatStatus(self::STATUS_STRAY_USER);
$du->setLastPrivateMessage($message->getMessageId());
$du->poke($this->replyUser);
}
}
public static function isPrivateChatContextChecker($update): bool
{
if ($update instanceof Message) return $update->getChat()->getType() == "private";
else return $update->getMessage()->getChat()->getType() == "private";
}
public static function isPublicChatContextChecker($update): bool
{
return !PrivateChat::isPrivateChatContextChecker($update);
}
public function sendMessageToGroups(string $data): void
{
$du = DatabaseUser::getByChat($this->database, $this->replyUser);
$list = Group::listAll($this->database);
$text = "Inviando a...\n\n";
foreach ($list as $group) {
$text .= "➡️ " . $group->getName();
if ($group->getUsername()) $text .= " (" . $group->getUsername() . ")";
$text .= "\n";
try {
$this->bot->sendMessage($group->getTelegramId(), $data, "HTML", false, null);
$text .= ": ✅ OK\n";
} catch (Exception $e) {
$text .= ": ❌ Errore\n";
}
}
$text .= "\n\n ... fatto";
$keyboard = new InlineKeyboardMarkup([
[
['text' => "✅Ok", 'callback_data' => 'endSet#save']
]
]);
$message = $this->bot->sendMessage($this->replyUser->getId(), $text, "HTML", false, null, $keyboard);
$du->setPrivateChatStatus(self::STATUS_ENDED);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function writeMessage(): void
{
$du = DatabaseUser::getByChat($this->database, $this->replyUser);
$keyboard = new InlineKeyboardMarkup([
[
['text' => "❌ Annulla", 'callback_data' => 'endSet#save']
]
]);
$message = $this->bot->sendMessage($this->replyUser->getId(), "Scrivi un messaggio in formato HTML da inviare a <b>tutti i gruppi</b>", "HTML", false, null, $keyboard);
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$du->setPrivateChatStatus(self::STATUS_MESSAGE_SEND);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function exclude(): void
{
$du = DatabaseUser::getByChat($this->database, $this->replyUser);
$keyboard = new InlineKeyboardMarkup([
[
['text' => "✅ Escludimi", 'callback_data' => 'yesExclude'],
['text' => "❌ Annulla", 'callback_data' => 'noExclude']
]
]);
$message = $this->bot->sendMessage($this->replyUser->getId(), "Con questa scelta il bot eliminetà i tuoi dati, non ti disturberà più e non salverà tuoi dati finchè tu non lo richiederai\n<b>Non sei sicurə?</b> Puoi sempre cambiare idea più tardi!", "HTML", false, null, $keyboard);
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
private function getStateVal(DatabaseUser $u, string $c): ?string
{
if ($c == PrivateChat::STATUS_ASK_NAME) return $u->getUName();
if ($c == PrivateChat::STATUS_ASK_BIRTH) return $u->getUbirthDate();
if ($c == PrivateChat::STATUS_ASK_GENDER) return $u->getUGender();
if ($c == PrivateChat::STATUS_ASK_ORIENT) return $u->getUOrient();
if ($c == PrivateChat::STATUS_ASK_WHERE) return $u->getUPlace();
if ($c == PrivateChat::STATUS_ASK_PVT) return $u->getUpvtChoice();
if ($c == PrivateChat::STATUS_ASK_REL) return $u->getURelationships();
if ($c == PrivateChat::STATUS_ASK_BIO) return $u->getUBio();
return null;
}
public static array $order = [
self::STATUS_ASK_NAME,
self::STATUS_ASK_BIRTH,
self::STATUS_ASK_GENDER,
self::STATUS_ASK_ORIENT,
self::STATUS_ASK_WHERE,
self::STATUS_ASK_PVT,
self::STATUS_ASK_REL,
self::STATUS_ASK_BIO
];
private function getPrevState(string $state): ?string
{
$index = array_search($state, self::$order);
if ($index === false) throw new NotFoundException();
if ($index === 0) return null;
return self::$order[$index - 1];
}
private static function getNextState(string $state): ?string
{
$index = array_search($state, self::$order);
if ($index === false) throw new NotFoundException();
if ($index === count(self::$order) - 1) return null;
return self::$order[$index + 1];
}
private static function getRemaining(string $state): int
{
$index = array_search($state, self::$order);
return count(self::$order) - $index - 1;
}
private function getKeyboard(DatabaseUser $du, string $state, array $nextRows)
{
$list = [];
$prev = $this->getPrevState($state);
$next = $this->getNextState($state);
if ($prev) {
if ($this->getStateVal($du, $prev)) {
$list[] = [['text' => "⏮️✏️ Indietro", 'callback_data' => 'go#' . $prev]];
} else {
$list[] = [['text' => "⏮️🆕 Indietro", 'callback_data' => 'go#' . $prev]];
}
}
if ($this->getStateVal($du, $state)) $list[] = [['text' => "🔄 Reimposta", 'callback_data' => 'go#' . $state . "#reset"]];
if ($next) {
if ($this->getStateVal($du, $next)) {
if (!$this->getStateVal($du, $state)) $list[] = [['text' => "⏭✏️ Avanti (salta questa)", 'callback_data' => 'go#' . $next]];
else $list[] = [['text' => "⏭✏️ Avanti", 'callback_data' => 'go#' . $next]];
} else {
if (!$this->getStateVal($du, $state)) $list[] = [['text' => "⏭🆕 Avanti (salta questa)", 'callback_data' => 'go#' . $next]];
else $list[] = [['text' => "⏭🆕 Avanti", 'callback_data' => 'go#' . $next]];
}
if ($du->countCompleted() == count(self::$order)) $list[] = [['text' => "✅ Fine", 'callback_data' => 'endSet']];
else $list[] = [['text' => "✅ Fine (" . $du->countCompleted() . "/" . count(self::$order) . " domande completate)", 'callback_data' => 'endSet']];
} else {
$list[] = [['text' => "✅ Fine", 'callback_data' => 'endSet']];
}
$list = array_merge($list, $nextRows); // concat arrays
return $list;
}
public function excludeYes()
{
$du = DatabaseUser::getByChat($this->database, $this->replyUser);
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$du = DatabaseUser::getByChat($this->database, $this->replyUser);
$du->setPrivateChatStatus(self::STATUS_EXCLUDED);
$du->setUName(null);
$du->setUbirthDate(null);
$du->setUGender(null);
$du->setUOrient(null);
$du->setUPlace(null);
$du->setUpvtChoice(null);
$du->setURelationships(null);
$du->setUBio(null);
$keyboard = new InlineKeyboardMarkup([
[
['text' => "✅ Riabilitami", 'callback_data' => 'noExclude']
]
]);
$message = $this->bot->sendMessage($this->replyUser->getId(), "La tua scelta è stata confermata. Io rimango qui se cambi idea.", "HTML", false, null, $keyboard);
$du->setLastPrivateMessage($message->getMessageId());
$du->setOptedOut(true);
$du->save(false);
}
public function completedMenu(): void
{
$du = DatabaseUser::getByChat($this->database, $this->replyUser);
$keys = [
[
['text' => "✏️" . ($du->getUName() ? "" : "🆕") . "Modifica Nome", 'callback_data' => 'go#' . self::STATUS_ASK_NAME],
['text' => "✏️" . ($du->getUbirthDate() ? "" : "🆕") . "Modifica Data di Nascita", 'callback_data' => 'go#' . self::STATUS_ASK_BIRTH]
],
[
['text' => "✏️" . ($du->getUGender() ? "" : "🆕") . "Modifica Genere", 'callback_data' => 'go#' . self::STATUS_ASK_GENDER],
['text' => "✏️" . ($du->getUOrient() ? "" : "🆕") . "Modifica Orientamento", 'callback_data' => 'go#' . self::STATUS_ASK_ORIENT]
],
[
['text' => "✏️" . ($du->getUPlace() ? "" : "🆕") . "Modifica Provenienza", 'callback_data' => 'go#' . self::STATUS_ASK_WHERE],
['text' => "✏️" . ($du->getUpvtChoice() ? "" : "🆕") . "Modifica Messaggi privati", 'callback_data' => 'go#' . self::STATUS_ASK_PVT]
],
[
['text' => "✏️" . ($du->getURelationships() ? "" : "🆕") . "Modifica Relazioni", 'callback_data' => 'go#' . self::STATUS_ASK_REL],
['text' => "✏️" . ($du->getUBio() ? "" : "🆕") . "Modifica Bio", 'callback_data' => 'go#' . self::STATUS_ASK_BIO]
],
[
['text' => "💳Visualizza Card", 'callback_data' => 'viewCard']
],
[
['text' => "📄Visualizza Info", 'callback_data' => 'viewInfo']
],
[
['text' => "🔍Visualizza Spiegazione", 'callback_data' => 'viewExp']
],
[
['text' => "🚫 Rimuovi consenso", 'callback_data' => "excludeMe"]
]
];
if ($this->replyUser->getId() == $GLOBALS["masterId"]) {
$keys[] = [
['text' => "✏️ Scrivi messaggio", 'callback_data' => "writeMessage"]
];
}
$keyboard = new InlineKeyboardMarkup($keys);
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"<b>Menu</b>",
"HTML",
false,
null,
$keyboard
);
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function end($ask = false)
{
$du = DatabaseUser::getByChat($this->database, $this->replyUser);
if (!$ask) {
$du->setPrivateChatStatus(self::STATUS_ENDED);
$add = "";
/*$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"Abbiamo Finito!" . $add,
"HTML",
false,
null
);*/
$du->save(false);
$this->completedMenu();
} else {
$keyboard = new InlineKeyboardMarkup([
[
['text' => "✅Salva comunque", 'callback_data' => 'endSet#save']
],
[
['text' => "⏭✏Torna alla modifica", 'callback_data' => 'go#' . $du->getPrivateChatStatus()]
],
[
['text' => "Rivedi le domande", 'callback_data' => 'go#' . self::STATUS_ASK_NAME],
]
]);
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$add = $du->listUncompleted();
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"<b>Alcune domande non hanno risposta</b>:" . $add,
"HTML",
false,
null,
$keyboard
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
}
public function yesPolicy()
{
$du = DatabaseUser::getByChat($this->database, $this->replyUser);
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"Grazie! Ora possiamo procedere a costruire il tuo profilo\nTi farò una serie di domande.\nRicordati che <b>puoi sempre saltare domande specifiche</b>\n Le risposte saranno visibili in tutti i gruppi che adottano questo bot.",
"HTML"
);
$du->setLastPrivateMessage($message->getMessageId());
$du->setPolicyAccepted(true);
$du->save(false);
$this->askName($du);
}
public function askName(DatabaseUser $du)
{
$du->setPrivateChatStatus(self::STATUS_ASK_NAME);
$keyboard = new InlineKeyboardMarkup($this->getKeyboard($du, self::STATUS_ASK_NAME, []));
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$add = "";
if ($du->getUName()) $add = "\nRisposta corrente: <i>" . $du->getUName() . "</i>";
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"<b>Come ti Chiami?</b> (massimo <b>40</b> caratteri) " . $add,
"HTML",
false,
null,
$keyboard
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function askBio(DatabaseUser $du)
{
$du->setPrivateChatStatus(self::STATUS_ASK_BIO);
$keyboard = new InlineKeyboardMarkup($this->getKeyboard($du, self::STATUS_ASK_BIO, []));
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$add = "";
if ($du->getUBio()) $add = "\nRisposta corrente: <i>" . $du->getUBio() . "</i>";
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"<b>Scrivi una breve descrizione di te stessə (bio)</b> (massimo <b>500</b> caratteri) " . $add,
"HTML",
false,
null,
$keyboard
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function askGender(DatabaseUser $du)
{
$du->setPrivateChatStatus(self::STATUS_ASK_GENDER);
$keyboard = new InlineKeyboardMarkup($this->getKeyboard($du, self::STATUS_ASK_GENDER, [
[
['text' => "Uomo", 'callback_data' => 'setGender#Uomo'],
['text' => "Donna", 'callback_data' => 'setGender#Donna'],
['text' => "Non-Binary", 'callback_data' => 'setGender#Non-Binary']
],
[
['text' => "Donna Transgender (MtF)", 'callback_data' => 'setGender#Donna Transgender (MtF)'],
['text' => "Uomo Transgender (FtM)", 'callback_data' => 'setGender#Uomo Transgender (FtM)']
],
[
['text' => "Non-Binary Transgender", 'callback_data' => 'setGender#Non-Binary Transgender'],
['text' => "Genderqueer", 'callback_data' => 'setGender#Genderqueer']
],
[
['text' => "Demiboy", 'callback_data' => 'setGender#Demiboy'],
['text' => "Demigirl", 'callback_data' => 'setGender#Demigirl']
],
[
['text' => "👉Imposta Personalizzato", 'callback_data' => 'setGender#custom']
]
]));
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$add = "";
if ($du->getUGender()) $add = "\nRisposta corrente: <i>" . $du->getUGender() . "</i>";
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"<b>Quel'è il tuo genere?</b> (massimo <b>40</b> caratteri) " . $add,
"HTML",
false,
null,
$keyboard
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function askRel(DatabaseUser $du)
{
$du->setPrivateChatStatus(self::STATUS_ASK_REL);
$keyboard = new InlineKeyboardMarkup($this->getKeyboard($du, self::STATUS_ASK_REL, [
[
['text' => "Fidanzatə", 'callback_data' => 'setRel#Fidanzatə'],
['text' => "Single", 'callback_data' => 'setRel#Single'],
['text' => "Aiutatemi vi prego", 'callback_data' => 'setRel#Aiutatemi vi prego']
],
[
['text' => "👉Imposta Personalizzato", 'callback_data' => 'setRel#custom']
]
]));
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$add = "";
if ($du->getURelationships()) $add = "\nRisposta corrente: <i>" . $du->getURelationships() . "</i>";
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"<b>Relazioni?</b> (massimo <b>40</b> caratteri) " . $add,
"HTML",
false,
null,
$keyboard
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function askPVT(DatabaseUser $du)
{
$du->setPrivateChatStatus(self::STATUS_ASK_PVT);
$keyboard = new InlineKeyboardMarkup($this->getKeyboard($du, self::STATUS_ASK_PVT, [
[
['text' => "", 'callback_data' => 'setPVT#Sì'],
['text' => "No", 'callback_data' => 'setPVT#No'],
['text' => "Solo se mi chiedono prima", 'callback_data' => 'setPVT#Solo se mi chiedono prima']
],
[
['text' => "👉Imposta Personalizzato", 'callback_data' => 'setPVT#custom']
]
]));
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$add = "";
if ($du->getUpvtChoice()) $add = "\nRisposta corrente: <i>" . $du->getUpvtChoice() . "</i>";
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"<b>Vuoi poter essere contattatə dagli altri utenti?</b> (massimo <b>40</b> caratteri) " . $add,
"HTML",
false,
null,
$keyboard
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function askWhere(DatabaseUser $du)
{
$du->setPrivateChatStatus(self::STATUS_ASK_WHERE);
$keyboard = new InlineKeyboardMarkup($this->getKeyboard($du, self::STATUS_ASK_WHERE, [
[
['text' => "Abruzzo", 'callback_data' => 'setWhere#Abruzzo'],
['text' => "Basilicata", 'callback_data' => 'setWhere#Basilicata'],
['text' => "Calabria", 'callback_data' => 'setWhere#Calabria']
],
[
['text' => "Campania", 'callback_data' => 'setWhere#Campania'],
['text' => "Emilia-Romagna", 'callback_data' => 'setWhere#Emilia-Romagna'],
['text' => "Friuli-Venezia Giulia", 'callback_data' => 'setWhere#Friuli-Venezia Giulia']
],
[
['text' => "Lazio", 'callback_data' => 'setWhere#Lazio'],
['text' => "Liguria", 'callback_data' => 'setWhere#Liguria'],
['text' => "Lombardia", 'callback_data' => 'setWhere#Lombardia']
],
[
['text' => "Marche", 'callback_data' => 'setWhere#Marche'],
['text' => "Molise", 'callback_data' => 'setWhere#Molise'],
['text' => "Piemonte", 'callback_data' => 'setWhere#Piemonte']
],
[
['text' => "Puglia", 'callback_data' => 'setWhere#Puglia'],
['text' => "Sardegna", 'callback_data' => 'setWhere#Sardegna'],
['text' => "Sicilia", 'callback_data' => 'setWhere#Sicilia']
],
[
['text' => "Toscana", 'callback_data' => 'setWhere#Toscana'],
['text' => "Trentino-Alto Adige", 'callback_data' => 'setWhere#Trentino-Alto Adige'],
['text' => "Umbria", 'callback_data' => 'setWhere#Umbria']
],
[
['text' => "Valle d'Aosta", 'callback_data' => 'setWhere#Valle d\'Aosta'],
['text' => "Veneto", 'callback_data' => 'setWhere#Veneto']
],
[
['text' => "👉Imposta Personalizzato", 'callback_data' => 'setWhere#custom']
]
]));
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$add = "";
if ($du->getUPlace()) $add = "\nRisposta corrente: <i>" . $du->getUPlace() . "</i>";
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"<b>Da dove vieni?</b> (massimo <b>40</b> caratteri) " . $add,
"HTML",
false,
null,
$keyboard
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function askOrient(DatabaseUser $du)
{
$du->setPrivateChatStatus(self::STATUS_ASK_ORIENT);
$keyboard = new InlineKeyboardMarkup($this->getKeyboard($du, self::STATUS_ASK_ORIENT, [
[
['text' => "Etero", 'callback_data' => 'setOrient#Etero'],
['text' => "Gay", 'callback_data' => 'setOrient#Gay'],
['text' => "Bisessuale", 'callback_data' => 'setOrient#Bisessuale']
],
[
['text' => "Lesbica", 'callback_data' => 'setOrient#Lesbica'],
['text' => "Pansessuale", 'callback_data' => 'setOrient#Pansessuale'],
['text' => "Asessuale", 'callback_data' => 'setOrient#Asessuale']
],
[
['text' => "Demisessuale", 'callback_data' => 'setOrient#Demisessuale'],
['text' => "Questioning", 'callback_data' => 'setOrient#Questioning'],
],
[
['text' => "👉Imposta Personalizzato", 'callback_data' => 'setOrient#custom']
]
]));
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$add = "";
if ($du->getUOrient()) $add = "\nRisposta corrente: <i>" . $du->getUOrient() . "</i>";
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"<b>Quel'è il tuo orientamento?</b> (massimo <b>40</b> caratteri) " . $add,
"HTML",
false,
null,
$keyboard
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function askBirthDate(DatabaseUser $du, bool $invalid = false)
{
$du->setPrivateChatStatus(self::STATUS_ASK_BIRTH);
$keyboard = new InlineKeyboardMarkup($this->getKeyboard($du, self::STATUS_ASK_BIRTH, []));
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$add = "";
if ($invalid) $add .= "\n<b>Data invalida</b>";
if ($du->getUbirthDate()) $add .= "\nRisposta corrente: <i>" . date("d/m/Y", $du->getUbirthDate()) . " (" . $du->getAge() . " anni)</i>";
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"Quando Sei Natə?\n<b>Formato data: giorno/mese/anno</b>" . $add,
"HTML",
false,
null,
$keyboard
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
public function noPolicy()
{
$du = DatabaseUser::getByChat($this->database, $this->replyUser);
$du->setPrivateChatStatus(self::STATUS_NOT_CONSENT);
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$this->replyUser->getId(),
$du->getLastPrivateMessage()
);
$keyboard = new InlineKeyboardMarkup([
[
['text' => "✅ Ho cambiato idea", 'callback_data' => 'changedIdea']
]
]);
$message = $this->bot->sendMessage(
$this->replyUser->getId(),
"<b>Nessun Problema</b>, torna se hai cambiato idea. \nTi lascio la mia <a href=\"https://telegra.ph/Rainbow-Bot----Privacy-policy-08-04\">privacy policy</a> da consultare",
"HTML",
false,
null,
$keyboard
);
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
}
}

View File

@ -1,42 +0,0 @@
<?php
use \TelegramBot\Api\Types\Message;
use \TelegramBot\Api\Client;
class Rave extends Command
{
public static function exposedCommands(): array
{
return [];
}
const CLASSIC = "classic";
const GARFIELD = "garfield";
const MEGALOVANIA = "megalovania";
const OTAMATONE = "otamatone";
private string $mode;
public function __construct(Message $message, Client $bot, string $mode)
{
parent::__construct($message, $bot);
$this->mode = $mode;
}
public function execute(): void
{
$m = $this->message->getReplyToMessage();
if (!$m) {
$this->bot->sendMessage($this->message->getChat()->getId(), "Cita un messaggio di testo", null, false, $this->message->getMessageId());
} else {
$this->bot->sendChatAction($this->message->getChat()->getId(), "upload_video");
$this->bot->sendVideo(
$this->message->getChat()->getId(),
"https://crabrave.boringcactus.com/render?text=" . urlencode($m->getText()) . "&ext=mp4&style=" . $this->mode,
null,
null,
$this->message->getMessageId(),
null,
null,
"HTML"
);
}
}
}

View File

@ -1,26 +0,0 @@
<?php
class Tpdne extends Command
{
public static function exposedCommands(): array{
return [];
}
public function __construct(\TelegramBot\Api\Types\Message $message, \TelegramBot\Api\Client $bot)
{
parent::__construct($message, $bot);
}
public function execute(): void
{
$this->bot->sendChatAction($this->message->getChat()->getId(), "upload_photo");
$this->bot->sendPhoto(
$this->message->getChat()->getId(),
"https://thispersondoesnotexist.com/image?v=" . bin2hex(random_bytes(10)) . time(),
null,
$this->message->getMessageId(),
null,
null,
"HTML"
);
}
}

350
index.php
View File

@ -1,350 +0,0 @@
<?php
error_reporting(E_ALL);
use \TelegramBot\Api\Client;
use \TelegramBot\Api\Types\Update;
if (PHP_INT_MAX == 2147483647) die("64 bit plaform required");
require_once "vendor/autoload.php";
require_once "database/Database.php";
require_once "database/NotFoundException.php";
require_once "database/DatabaseUser.php";
require_once "handlers/Command.php";
require_once "handlers/Flip.php";
require_once "handlers/Inspire.php";
require_once "handlers/Tpdne.php";
require_once "handlers/Rave.php";
require_once "handlers/Eva.php";
require_once "handlers/PrivateChat.php";
require_once "database/Group.php";
require_once "handlers/GroupWatcher.php";
require_once "handlers/Card.php";
require_once "handlers/Lookup.php";
require_once "handlers/Explain.php";
require_once "config.php";
try {
$bot = new Client($GLOBALS["token"]);
$database = new Database(new PDO("sqlite:database.sqlite3"));
$bot->command('fliph', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$flip = new Flip($message, $bot, Flip::HORIZONTAL);
$flip->execute();
});
$bot->command('flipv', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$flip = new Flip($message, $bot, Flip::VERTICAL);
$flip->execute();
});
$bot->command('flipb', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$flip = new Flip($message, $bot, Flip::BOTH);
$flip->execute();
});
//TODO implement [commands] /card /lookup /help /rabio /stats
//TODO create private flow, with interactive buttons and datepicker
//TOO create admin comm ands and all logic
$bot->command('inspire', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$inspire = new Inspire($message, $bot);
$inspire->execute();
});
$bot->command('tpdne', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$inspire = new Tpdne($message, $bot);
$inspire->execute();
});
$bot->command('rave', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$inspire = new Rave($message, $bot, Rave::CLASSIC);
$inspire->execute();
});
$bot->command('garfield', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$inspire = new Rave($message, $bot, Rave::GARFIELD);
$inspire->execute();
});
$bot->command('megalovania', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$inspire = new Rave($message, $bot, Rave::MEGALOVANIA);
$inspire->execute();
});
$bot->command('otamatone', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$inspire = new Rave($message, $bot, Rave::OTAMATONE);
$inspire->execute();
});
$bot->command('info', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$bot->sendMessage($message->getChat()->getId(), "V 10.0.0 by @matmasak\n Open source code on https://github.com/MatMasIt/rainbowBot", null, false, $message->getMessageId());
});
/*$bot->command('debug', function ($message) use ($bot) {
$bot->sendMessage($message->getChat()->getId(), $bot->getRawBody(), null, false, $message->getMessageId());
});*/
$bot->command('eva', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$eva = new Eva($message, $bot);
$eva->execute();
});
$bot->command('card', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$card = new Card($message, $bot, $database);
$card->execute();
});
$bot->command('lookup', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$l = new Lookup($message, $bot, $database);
$l->execute();
});
$bot->command('explain', function ($message) use ($bot, $database) {
if (PrivateChat::isPrivateChatContextChecker($message)) return false;
GroupWatcher::watch($database, $message, $bot);
$l = new Explain($message, $bot, $database);
$l->execute();
});
# This function is called if someone clicks on an inline button
$bot->callbackQuery(function ($message) use ($bot, $database) {
if ($message->getData() == "noPolicy") {
$bot->answerCallbackQuery($message->getId());
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->noPolicy();
} elseif ($message->getData() == "yesPolicy") {
$bot->answerCallbackQuery($message->getId());
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->yesPolicy();
} elseif ($message->getData() == "whatIsThis") {
$bot->answerCallbackQuery($message->getId(), "Long descrizione");
} elseif ($message->getData() == "excludeMe") {
$bot->answerCallbackQuery($message->getId());
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->exclude();
} elseif ($message->getData() == "yesExclude") {
$bot->answerCallbackQuery($message->getId());
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->excludeYes();
} elseif ($message->getData() == "noExclude") {
$bot->answerCallbackQuery($message->getId());
$du = DatabaseUser::getByChat($database, $message->getFrom());
$du->setPrivateChatStatus(PrivateChat::STATUS_ASK_DM);
$du->setOptedOut(false);
$du->save(false);
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->execute();
} elseif ($message->getData() == "changedIdea") {
$bot->answerCallbackQuery($message->getId());
$du = DatabaseUser::getByChat($database, $message->getFrom());
$du->setPrivateChatStatus(PrivateChat::STATUS_ASK_DM);
$du->setOptedOut(false);
$du->save(false);
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->execute();
//syntax is skipTo#part
} elseif (explode("#", $message->getData())[0] == "go") {
$bot->answerCallbackQuery($message->getId());
$expl = explode("#", $message->getData());
$step = $expl[1];
$reset = $expl[2] === "reset";
$du = DatabaseUser::getByChat($database, $message->getFrom());
if ($reset) $du->setNULL($step);
$du->setPrivateChatStatus($step);
$du->setOptedOut(false);
$du->save(false);
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->execute(false);
} elseif (explode("#", $message->getData())[0] == "setGender") {
$bot->answerCallbackQuery($message->getId());
$expl = explode("#", $message->getData());
$text = $expl[1];
$du = DatabaseUser::getByChat($database, $message->getFrom());
if ($text == "custom") {
$message = $bot->sendMessage($message->getFrom()->getId(), "Scrivi il genere", null, false);
try {
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$du->getTelegramId(),
$du->getLastPrivateMessage()
);
} catch (\TelegramBot\Api\Exception $e) {
}
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
} else {
$du->setUGender($text);
$du->setOptedOut(false);
$du->save(false);
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->execute(false);
}
} elseif (explode("#", $message->getData())[0] == "setOrient") {
$bot->answerCallbackQuery($message->getId());
$expl = explode("#", $message->getData());
$text = $expl[1];
$du = DatabaseUser::getByChat($database, $message->getFrom());
if ($text == "custom") {
$message = $bot->sendMessage($message->getFrom()->getId(), "Scrivi l'orientamento", null, false);
try {
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$du->getTelegramId(),
$du->getLastPrivateMessage()
);
} catch (\TelegramBot\Api\Exception $e) {
}
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
} else {
$du->setUOrient($text);
$du->setOptedOut(false);
$du->save(false);
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->execute(false);
}
} elseif (explode("#", $message->getData())[0] == "setWhere") {
$bot->answerCallbackQuery($message->getId());
$expl = explode("#", $message->getData());
$text = $expl[1];
$du = DatabaseUser::getByChat($database, $message->getFrom());
if ($text == "custom") {
$message = $bot->sendMessage($message->getFrom()->getId(), "Scrivi da dove vieni", null, false);
try {
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$du->getTelegramId(),
$du->getLastPrivateMessage()
);
} catch (\TelegramBot\Api\Exception $e) {
}
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
} else {
$du->setUPlace($text);
$du->setOptedOut(false);
$du->save(false);
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->execute(false);
}
} elseif (explode("#", $message->getData())[0] == "setPVT") {
$bot->answerCallbackQuery($message->getId());
$expl = explode("#", $message->getData());
$text = $expl[1];
$du = DatabaseUser::getByChat($database, $message->getFrom());
if ($text == "custom") {
$message = $bot->sendMessage($message->getFrom()->getId(), "Scrivi una risposta personalizzata", null, false);
try {
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$du->getTelegramId(),
$du->getLastPrivateMessage()
);
} catch (\TelegramBot\Api\Exception $e) {
}
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
} else {
$du->setUpvtChoice($text);
$du->setOptedOut(false);
$du->save(false);
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->execute(false);
}
} elseif (explode("#", $message->getData())[0] == "setRel") {
$bot->answerCallbackQuery($message->getId());
$expl = explode("#", $message->getData());
$text = $expl[1];
$du = DatabaseUser::getByChat($database, $message->getFrom());
if ($text == "custom") {
$message = $bot->sendMessage($message->getFrom()->getId(), "Scrivi una risposta personalizzata", null, false);
try {
if ($du->getLastPrivateMessage() != 0) $this->bot->deleteMessage(
$du->getTelegramId(),
$du->getLastPrivateMessage()
);
} catch (\TelegramBot\Api\Exception $e) {
}
$du->setLastPrivateMessage($message->getMessageId());
$du->save(false);
} else {
$du->setURelationships($text);
$du->setOptedOut(false);
$du->save(false);
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->execute(false);
}
} elseif (explode("#", $message->getData())[0] == "endSet") {
$bot->answerCallbackQuery($message->getId());
$du = DatabaseUser::getByChat($database, $message->getFrom());
$expl = explode("#", $message->getData());
$askConf = $expl[1] != "save" && $du->countCompleted() != count(PrivateChat::$order);
$du = DatabaseUser::getByChat($database, $message->getFrom());
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->end($askConf);
} elseif ($message->getData() == "viewCard") {
$bot->answerCallbackQuery($message->getId());
$card = new Card($message->getMessage(), $bot, $database, $message->getFrom());
$du = DatabaseUser::getByChat($database, $message->getFrom());
$card->viewPVC($du);
} elseif ($message->getData() == "viewInfo") {
$bot->answerCallbackQuery($message->getId());
$card = new Lookup($message->getMessage(), $bot, $database, $message->getFrom());
$du = DatabaseUser::getByChat($database, $message->getFrom());
$card->pvtLookup($du);
} elseif ($message->getData() == "viewExp") {
$bot->answerCallbackQuery($message->getId());
$card = new Explain($message->getMessage(), $bot, $database, $message->getFrom());
$du = DatabaseUser::getByChat($database, $message->getFrom());
$card->pvtLookup($du);
} elseif ($message->getData() == "writeMessage") {
$bot->answerCallbackQuery($message->getId());
$p = new PrivateChat($message->getMessage(), $bot, $database, $message->getFrom());
$p->writeMessage();
}
});
$bot->on(function (Update $update) use ($bot, $database) {
$p = new PrivateChat($update->getMessage(), $bot, $database);
$p->execute();
}, function (Update $update) {
return PrivateChat::isPrivateChatContextChecker($update);
});
$bot->on(function (Update $update) use ($bot, $database) {
GroupWatcher::watch($database, $update->getMessage(), $bot);
}, function (Update $update) {
return PrivateChat::isPublicChatContextChecker($update);
});
$bot->run();
} catch (\TelegramBot\Api\Exception $e) {
file_put_contents("error.log", date("d/m/Y H:i:s") . "| " . $e->getMessage());
}

16
src/API.php Normal file
View File

@ -0,0 +1,16 @@
<?php
function API($method, $data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.telegram.org/".$GLOBALS["config"]["lgbt"]["TOKEN"]."/" . $method);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
return json_decode(curl_exec($ch) , true);
}

19567
src/DC.txt Normal file

File diff suppressed because it is too large Load Diff

100
src/aalist Normal file
View File

@ -0,0 +1,100 @@
https://youtube.com/watch?v=cpCdm7ZGrfA
https://youtube.com/watch?v=h29zK6_VstU
https://youtube.com/watch?v=UEGVxLs6Sr0
https://youtube.com/watch?v=GDP4ds-ozOI
https://youtube.com/watch?v=9_sAzyTCZzQ
https://youtube.com/watch?v=ANcuqk7x33o
https://youtube.com/watch?v=HK2VLhbSaoc
https://youtube.com/watch?v=UxnvGDK0WGM
https://youtube.com/watch?v=0nPfjHuKtw8
https://youtube.com/watch?v=YmYPxdQpwpQ
https://youtube.com/watch?v=lAWdWk6a2gg
https://youtube.com/watch?v=SPOFjeHS_hc
https://youtube.com/watch?v=upOhRRYVGkA
https://youtube.com/watch?v=_ItfF7ZGDgE
https://youtube.com/watch?v=B8eTxPdU4sQ
https://youtube.com/watch?v=pLtzOZe1vZI
https://youtube.com/watch?v=KbFlZQfXFjc
https://youtube.com/watch?v=dr4fdf8F3Yk
https://youtube.com/watch?v=oVbFMCFl9xE
https://youtube.com/watch?v=d1JT6ZDqIE0
https://youtube.com/watch?v=UPdY_f1ybn8
https://youtube.com/watch?v=V32y9gHJP0E
https://youtube.com/watch?v=e_FwZ6E5adA
https://youtube.com/watch?v=EtMfvQc-Rh8
https://youtube.com/watch?v=Sz-m7l_QoEo
https://youtube.com/watch?v=en8l-_-rBgw
https://youtube.com/watch?v=CvqIHkfXlM8
https://youtube.com/watch?v=3MRIi0ac8hc
https://youtube.com/watch?v=JMg6N9PuOi8
https://youtube.com/watch?v=2FXO-QVjh9g
https://youtube.com/watch?v=5_tPakMnuyI
https://youtube.com/watch?v=obVQPIEPdRU
https://youtube.com/watch?v=HNBhziViepg
https://youtube.com/watch?v=ANcWZHFIcIM
https://youtube.com/watch?v=yQpyHftAF5U
https://youtube.com/watch?v=C_mNhW9PfS4
https://youtube.com/watch?v=C_Bv1wF40JI
https://youtube.com/watch?v=3tgDWKlJsSM
https://youtube.com/watch?v=_HaMSS7-lwQ
https://youtube.com/watch?v=-i5tt2-V2SE
https://youtube.com/watch?v=lP06Gve7VWg
https://youtube.com/watch?v=36pwF_fh5b0
https://youtube.com/watch?v=gBfFRGY-vto
https://youtube.com/watch?v=7Cl98sQPDhU
https://youtube.com/watch?v=wVkyy04CkTk
https://youtube.com/watch?v=YB5MFl3aH2Q
https://youtube.com/watch?v=02oEoK84490
https://youtube.com/watch?v=-Q2X1uoWEdI
https://youtube.com/watch?v=GjmCbOFI1bk
https://youtube.com/watch?v=f54XlAqBDug
https://youtube.com/watch?v=z6kKqU-FkRc
https://youtube.com/watch?v=9yA3qrxxues
https://youtube.com/watch?v=VXS56M5wLJE
https://youtube.com/watch?v=72LiIZ3M8jM
https://youtube.com/watch?v=vYPL7ZN4E_o
https://youtube.com/watch?v=pYfV_OzdYPk
https://youtube.com/watch?v=UjvOaYK7SgM
https://youtube.com/watch?v=HtlWpGcCl5k
https://youtube.com/watch?v=sAqnzsnw1m0
https://youtube.com/watch?v=Gr4ELHLTV-A
https://youtube.com/watch?v=sAM-XMc8OAc
https://youtube.com/watch?v=dcuK7tHFg6M
https://youtube.com/watch?v=QI55FRv28Kw
https://youtube.com/watch?v=jNPkCfUHgtI
https://youtube.com/watch?v=aC_-WxlTMVQ
https://youtube.com/watch?v=VzW7ou4UaZg
https://youtube.com/watch?v=kkfX4Y-WkDs
https://youtube.com/watch?v=4GeSY3Kkbgc
https://youtube.com/watch?v=hNMXmNUKH4s
https://youtube.com/watch?v=KepUb2l6K3E
https://youtube.com/watch?v=Zg_2xTUwyZA
https://youtube.com/watch?v=QI_0ECz59ug
https://youtube.com/watch?v=_TePxy7Hc3M
https://youtube.com/watch?v=9IoF2nhr1Jk
https://youtube.com/watch?v=lpSpJqFVMtc
https://youtube.com/watch?v=b6pvnwwbNFA
https://youtube.com/watch?v=wP1DJ_D4chA
https://youtube.com/watch?v=UtXiYk1WUwQ
https://youtube.com/watch?v=DCm4mlQi4Rc
https://youtube.com/watch?v=Hy-qT6qfZSA
https://youtube.com/watch?v=vru3V9XcNDc
https://youtube.com/watch?v=V-DUwGZiN_E
https://youtube.com/watch?v=_6nkTj26ghk
https://youtube.com/watch?v=xBk1GIy3m4I
https://youtube.com/watch?v=JKXJSVafDag
https://youtube.com/watch?v=t1rjTDfLhLM
https://youtube.com/watch?v=QJa9u_5_zK4
https://youtube.com/watch?v=Ry87VcpXwjo
https://youtube.com/watch?v=2DTjNriHboA
https://youtube.com/watch?v=Bag1lm8CA4M
https://youtube.com/watch?v=ZI0JFEHElUA
https://youtube.com/watch?v=MIQXomPzm2I
https://youtube.com/watch?v=iFQ8wVjTPiE
https://youtube.com/watch?v=maqy9IuJjCo
https://youtube.com/watch?v=o7GMQvoJmQQ
https://youtube.com/watch?v=76RcshkmOYk
https://youtube.com/watch?v=yDHWjWSxj2s
https://youtube.com/watch?v=i_t_dhE1zIE
https://youtube.com/watch?v=6TjCzeXciV0
https://youtube.com/watch?v=5quxFte-97o

42414
src/bibbia.txt Normal file

File diff suppressed because one or more lines are too long

1
src/cah.json Normal file

File diff suppressed because one or more lines are too long

106
src/chart.php Normal file
View File

@ -0,0 +1,106 @@
<?php
function orientChart($orients,$filename){
/*************Configuration Starts******************/
// Heading
$chartTitle = "Orientamenti";
// Branding / extra label (optional)
$logo = "Dati del ".date("d/m/Y").", ".date("H:i:s");
// Data
$arrData=$orients;
/*************************End****************************/
/*****************For Programmers************************/
$scale=2;
$imageWidth = 300*$scale; //image width
$imageHeight = 200*$scale; //image height
$diameter = 150*$scale-50; //pie diameter
$centerX = 100*$scale; //pie center pixels x
$centerY = 100*$scale; //pie center pixels y
$labelWidth = 10*$scale; //label width, no need to change
/*************************End****************************/
createPieChart($arrData, $chartTitle, $logo, $imageWidth, $imageHeight, $diameter, $centerX, $centerY, $labelWidth,$filename);
}
function createPieChart($arrData, $chartTitle, $logo, $imageWidth, $imageHeight, $diameter, $centerX, $centerY, $labelWidth,$filename) {
$item = array_keys($arrData);
$data = array_values($arrData);
for( $i = 0; $i < count( $data ); $i++ ) {
$dataTotal += $data[ $i ];
}
$im = ImageCreate( $imageWidth, $imageHeight );
$color[] = ImageColorAllocate( $im, 255, 0, 0 ); //red
$color[] = ImageColorAllocate( $im, 255, 204, 0 );//yellow
$color[] = ImageColorAllocate( $im, 153, 204, 0 );//green
$color[] = ImageColorAllocate( $im, 153, 51, 255 );//purple
$color[] = ImageColorAllocate( $im, 0, 128, 255 );//blue
$color[] = ImageColorAllocate( $im, 255, 0, 128 );//pink
$color[] = ImageColorAllocate( $im, 192, 192, 192 );//grey
$color[] = ImageColorAllocate( $im, 204, 204, 0 );
$color[] = ImageColorAllocate( $im, 64, 128, 128 );
$color[] = ImageColorAllocate( $im, 204, 102, 153 );
$white = ImageColorAllocate( $im, 255, 255, 255 );
$black = ImageColorAllocate( $im, 0, 0, 0 );
$grey = ImageColorAllocate( $im, 215, 215, 215 );
ImageFill( $im, 0, 0, $white );
$degree = 0;
for( $i = 0; $i < count( $data ); $i++ ) {
$startDegree = round( $degree );
$degree += ( $data[ $i ] / $dataTotal ) * 360;
$endDegree = round( $degree );
$currentColor = $color[ $i % ( count( $color ) ) ];
ImageArc( $im, $centerX, $centerY, $diameter, $diameter, $startDegree, $endDegree, $currentColor );
list( $arcX, $arcY ) = circlePoint( $startDegree, $diameter );
ImageLine( $im, $centerX, $centerY, floor( $centerX + $arcX ), floor( $centerY + $arcY ), $currentColor );
list( $arcX, $arcY ) = circlePoint( $endDegree, $diameter );
ImageLine( $im, $centerX, $centerY, ceil( $centerX + $arcX ), ceil( $centerY + $arcY ), $currentColor );
$midPoint = round( ( ( $endDegree - $startDegree ) / 2 ) + $startDegree );
list( $arcX, $arcY ) = circlePoint( $midPoint, $diameter / 1.5 );
ImageFillToBorder( $im, floor( $centerX + $arcX ), floor( $centerY + $arcY ), $currentColor, $currentColor );
ImageString( $im, 2, floor( $centerX + $arcX ), floor( $centerY + $arcY ), intval( round( $data[ $i ] / $dataTotal * 100 ) ) . "%", $black );
}
$labelX = $centerX + $diameter / 2 + 10;
$labelY = $centerY - $diameter / 4;
$titleX = $labelX - $diameter / 4;
$titleY = $centerY - $diameter / 2;
ImageString( $im, 3, $titleX + 1, $titleY + 1, $chartTitle, $grey );
ImageString( $im, 3, $titleX, $titleY, $chartTitle, $black );
for( $i = 0; $i < count( $item ); $i++ ) {
$currentColor = $color[ $i % ( count( $color ) ) ];
ImageRectangle( $im, $labelX, $labelY, $labelX + $labelWidth, $labelY + $labelWidth, $black );
ImageFilledRectangle( $im, $labelX + 1, $labelY + 1, $labelX + $labelWidth, $labelY + $labelWidth, $currentColor );
ImageString( $im, 2, $labelX + $labelWidth + 5, $labelY, $item[ $i ], $black );
ImageString( $im, 2, $labelX + $labelWidth + 90, $labelY, $data[ $i ]." %", $black );
$labelY += $labelWidth + 2;
}
//ImageString( $im, 3, $labelX, $labelY, "Total:", $black );
ImageString( $im, 3, $labelX + $labelWidth + 60, $labelY, $dataTotal, $black );
ImageString( $im, 2, $labelX, $labelY + 15, $logo, $black );
ImagePNG( $im ,$filename);
ImageDestroy( $im );
}
function circlePoint( $deg, $dia ) {
$x = cos( deg2rad( $deg ) ) * ( $dia / 2 );
$y = sin( deg2rad( $deg ) ) * ( $dia / 2 );
return array( $x, $y );
}

1
src/eq.json Normal file

File diff suppressed because one or more lines are too long

86
src/eva.php Normal file
View File

@ -0,0 +1,86 @@
<?php
function evaSplit($text){
$text=chunk_split($text,38,"\n");
$list=explode("\n",$text);
array_filter($list);
$f="";
foreach($list as $el){
$f.=htmlentities(trim($el))."<br />";
}
return $f;
}
$data=json_decode($_GET["data"]);
if($data==null){
?>
<header class="eva-heading">
<h2 class="eva-heading__title">NEON</h2>
<h2 class="eva-heading__title">GENESIS</h2>
<h1 class="eva-heading__title">EVANGELION</h1>
<h3 class="eva-heading__episode-number">EPISODE: 4</h3>
<h4 class="eva-heading__episode-title">
Those woman longed for the touch of <br>others' lips, and thus invited their kisses
</h4>
</header>
<?php
}
else{
?>
<header class="eva-heading">
<h2 class="eva-heading__title"><?php echo htmlentities($data[0]); ?></h2>
<h2 class="eva-heading__title"><?php echo htmlentities($data[1]); ?></h2>
<h1 class="eva-heading__title"><?php echo htmlentities($data[2]); ?></h1>
<h3 class="eva-heading__episode-number"><?php echo htmlentities($data[3]); ?></h3>
<h4 class="eva-heading__episode-title">
<?php echo evaSplit($data[4]); ?>
</h4>
</header>
<?php
}
?>
<style>* {
margin: 0;
padding: 0;
}
body {
background-color: black;
}
.eva-heading {
padding: 32px;
align-self: baseline;
font-family: serif;
color: white;
text-shadow: 0 0 2px #e19a86, 0 0 1.5px #854535, 0 0 1.5px #5c150c;
width:600px;
height:478px;
}
.eva-heading > h1 {
font-size: 500%;
}
.eva-heading > h2 {
font-size: 300%;
}
.eva-heading__title {
transform: scale(1, 1.5);
line-height: 1.2em;
letter-spacing: -.03em;
}
.eva-heading__episode-number {
font-family: sans-serif;
font-size: 180%;
transform: scale(1, 1.5);
letter-spacing: -.06em;
margin: 10px 0 26px 0;
}
.eva-heading__episode-title {
transform: scale(1, 1.3);
font-size: 170%;
line-height: 1em;
}
</style>

4
src/evas/do.php Normal file
View File

@ -0,0 +1,4 @@
<?php
foreach(glob("*.gif") as $r){
echo "\"https://webport.altervista.org/bots/telegram/lgbt/evas/".basename($r)."\",\n";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

11
src/ezechiele.txt Normal file
View File

@ -0,0 +1,11 @@
Ezechiele 25,17.
Il cammino dell'uomo timorato è minacciato da ogni parte dalle iniquità degli esseri egoisti e dalla tirannia degli uomini malvagi.
Benedetto sia colui che nel nome della carità e della buona volontà conduce i deboli attraverso la valle delle tenebre; perché egli è in verità il pastore di suo fratello e il ricercatore dei figli smarriti.
E la mia giustizia calerà sopra di loro con grandissima vendetta e furiosissimo sdegno su coloro che si proveranno ad ammorbare ed infine a distruggere i miei fratelli.
E tu saprai che il mio nome è quello del Signore quando farò calare la mia vendetta sopra di te.
#
Ezekiel 25:17.
The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men.
Blessed is He who in the name of charity and good will shepherds the weak through the valley of darkness, for He is truly his brother's keeper and the finder of lost children.
And I will strike down upon thee with great vengeance and furious anger those who attempt to poison and destroy My brothers.
And you will know My name is the Lord when I lay My vengeance upon thee.

10
src/fetchCard.php Normal file
View File

@ -0,0 +1,10 @@
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if($_GET["pass"]!="737373737361113273") exit;
$file = 'gdImg/archive/'.$_GET["id"].'.fi.jpeg';
$type = 'image/jpeg'; header('Content-Type:'.$type); header('Content-Length: ' . filesize($file));
readfile($file);
unlink($file);
unlink('gdImg/archive/'.$_GET["id"].'.pp.jpeg');

BIN
src/gdImg/Roboto-Thin.ttf Normal file

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

BIN
src/gdImg/archive/.fi.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Some files were not shown because too many files have changed in this diff Show More