This commit is contained in:
2021-03-04 03:33:54 +03:00
parent 368382f63c
commit 5ac17d713f
67 changed files with 1824 additions and 119 deletions
-5
View File
@@ -1,5 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
Generated
-1
View File
@@ -1 +0,0 @@
tg-ts-bot
+7
View File
@@ -0,0 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="meloda-main">
<words>
<w>tele</w>
</words>
</dictionary>
</component>
+267
View File
@@ -0,0 +1,267 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BranchesTreeState">
<expand>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
</path>
</expand>
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="4570b3ba-8ca9-473b-b662-8e4acc119298" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/.idea/dictionaries/meloda_main.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/answers.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/base/base.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/base/db.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/base/net.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/base/package.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/ae.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/base/command.d.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/base/commands.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/base/stats.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/dad.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/fuckYou.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/help.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/mom.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/mute.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/ping.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/q.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/randomString.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/systemSpecs.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/test.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/commands/unmute.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/data.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/debug_data.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.name" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.vscode/launch.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/index.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tsconfig.json" beforeDir="false" afterPath="$PROJECT_DIR$/tsconfig.json" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="tsconfig.json" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1pGFr81roZw9V4CxjwjI3wk7PBj" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="restartRequiresConfirmation" value="false" />
<property name="settings.editor.selected.configurable" value="preferences.sourceCode.TypeScript" />
<property name="ts.external.directory.path" value="C:\Program Files\JetBrains\WebStorm 2020.1\plugins\JavaScriptLanguage\jsLanguageServicesImpl\external" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\meloda-main\Workspace\Development\JavaScript\tg-ts-bot\commands\base" />
<recent name="C:\Users\meloda-main\Workspace\Development\JavaScript\tg-ts-bot\commands" />
<recent name="C:\Users\meloda-main\Workspace\Development\JavaScript\tg-ts-bot\commands\lib" />
</key>
</component>
<component name="RunManager">
<configuration name="index.js" type="NodeJSConfigurationType" nameIsGenerated="true" path-to-js-file="index.js" working-dir="$PROJECT_DIR$">
<method v="2">
<option name="TypeScript.Before.Run" enabled="true" FAIL_ON_ERROR="true" CONFIG_PATH="$PROJECT_DIR$/tsconfig.json" />
</method>
</configuration>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="4570b3ba-8ca9-473b-b662-8e4acc119298" name="Default Changelist" comment="" />
<created>1614801715917</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1614801715917</updated>
<workItem from="1614801717620" duration="6690000" />
<workItem from="1614808420471" duration="9549000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="2" />
<option name="exactExcludedFiles">
<list>
<option value="$PROJECT_DIR$/index.js" />
<option value="$PROJECT_DIR$/base/base.js.map" />
<option value="$PROJECT_DIR$/base/base.js" />
<option value="$PROJECT_DIR$/base/net.js" />
<option value="$PROJECT_DIR$/base/net.js.map" />
<option value="$PROJECT_DIR$/base/db.js" />
<option value="$PROJECT_DIR$/base/db.js.map" />
<option value="$PROJECT_DIR$/index.js.map" />
<option value="$PROJECT_DIR$/commands/base/stats.js" />
<option value="$PROJECT_DIR$/commands/base/stats.js.map" />
<option value="$PROJECT_DIR$/commands/dad.js" />
<option value="$PROJECT_DIR$/commands/randomString.js.map" />
<option value="$PROJECT_DIR$/commands/ping.js" />
<option value="$PROJECT_DIR$/commands/unmute.js.map" />
<option value="$PROJECT_DIR$/commands/unmute.js" />
<option value="$PROJECT_DIR$/commands/mom.js" />
<option value="$PROJECT_DIR$/commands/dad.js.map" />
<option value="$PROJECT_DIR$/commands/mute.js.map" />
<option value="$PROJECT_DIR$/commands/ae.js.map" />
<option value="$PROJECT_DIR$/commands/q.js.map" />
<option value="$PROJECT_DIR$/commands/randomString.js" />
<option value="$PROJECT_DIR$/commands/ping.js.map" />
<option value="$PROJECT_DIR$/commands/mom.js.map" />
<option value="$PROJECT_DIR$/commands/fuckYou.js.map" />
<option value="$PROJECT_DIR$/commands/systemSpecs.js" />
<option value="$PROJECT_DIR$/commands/q.js" />
<option value="$PROJECT_DIR$/commands/mute.js" />
<option value="$PROJECT_DIR$/commands/systemSpecs.js.map" />
<option value="$PROJECT_DIR$/commands/fuckYou.js" />
<option value="$PROJECT_DIR$/commands/ae.js" />
</list>
</option>
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="WindowStateProjectService">
<state x="414" y="175" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1614802857330">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="414" y="175" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614802857330" />
<state x="723" y="322" key="#com.intellij.fileTypes.FileTypeChooser" timestamp="1614817166437">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="723" y="322" key="#com.intellij.fileTypes.FileTypeChooser/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817166437" />
<state x="765" y="236" key="#com.intellij.ide.util.MemberChooser" timestamp="1614817064818">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="765" y="236" key="#com.intellij.ide.util.MemberChooser/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817064818" />
<state x="644" y="214" key="#com.intellij.refactoring.rename.AutomaticRenamingDialog" timestamp="1614816552557">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="644" y="214" key="#com.intellij.refactoring.rename.AutomaticRenamingDialog/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614816552557" />
<state x="690" y="267" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog" timestamp="1614813087174">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="690" y="267" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614813087174" />
<state x="669" y="178" key="#index.js" timestamp="1614814039183">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="669" y="178" key="#index.js/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614814039183" />
<state width="1899" height="399" key="GridCell.Tab.0.bottom" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.0.bottom/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.0.center" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.0.center/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.0.left" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.0.left/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.0.right" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.0.right/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.1.bottom" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.1.bottom/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.1.center" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.1.center/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.1.left" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.1.left/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.1.right" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.1.right/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.2.bottom" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.2.bottom/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.2.center" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.2.center/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.2.left" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.2.left/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.2.right" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.2.right/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.3.bottom" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.3.bottom/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.3.center" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.3.center/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.3.left" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.3.left/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state width="1899" height="399" key="GridCell.Tab.3.right" timestamp="1614817972274">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1899" height="399" key="GridCell.Tab.3.right/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817972274" />
<state x="461" y="165" key="SettingsEditor" timestamp="1614803101448">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="461" y="165" key="SettingsEditor/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614803101448" />
<state x="-1280" y="54" width="1296" height="1027" maximized="true" key="dock-window-1" timestamp="1614817285117">
<screen x="-1280" y="54" width="1280" height="984" />
</state>
<state x="-1280" y="54" width="1296" height="1027" maximized="true" key="dock-window-1/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614817285117" />
<state x="-1280" y="54" width="1296" height="1027" maximized="true" key="dock-window-2" timestamp="1614808260833">
<screen x="-1280" y="54" width="1280" height="984" />
</state>
<state x="-1280" y="54" width="1296" height="1027" maximized="true" key="dock-window-2/0.0.1920.1040/-1280.54.1280.984@0.0.1920.1040" timestamp="1614808260833" />
</component>
</project>
-14
View File
@@ -1,14 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\index.js"
}
]
}
+118
View File
@@ -0,0 +1,118 @@
{
"test": [
"я жив",
"тут",
"на месте",
"добрый день",
"слушаю",
"а",
"чо",
"чо нада",
"шо",
"шо нада",
"шо хочешь",
"чо хочешь",
"каво",
"чиво",
"чево",
"а?",
"а)",
"а по жопе",
"шо те",
"бан",
"а может бан...",
"бан, блять",
"БАН",
".!.",
"чё те надо",
"я вас слушаю",
"на связи",
"Да.",
"ты гей",
"хуест",
"да что тебе надо",
"отстань"
],
"better": [
"считаю, что лучше",
"по-моему, лучше",
"боженька сказал, что лучше",
"да ну, чё за глупый вопрос, лучше",
"лучше",
"о боже, ну конечно же лучше",
"точно лучше",
"не, ну лол, лучше",
"камон, лучше",
"аааааа лучше",
"о да, лучше"
],
"who": [
"",
"я считаю, что",
"100%",
"отвечаю,",
"смею предположить, что",
"наверное,",
"дай-ка подумаю.... хотя что тут думать,",
"ураааааа,",
"камон,",
"нуууу,",
"вау,",
"о да,"
],
"kick": [
"пока!",
"до свидания",
"бб",
"минус пидор",
"-пидор",
"пака",
"досвидули",
"как теперь житб..........",
"чао",
"ну вышел и вышел"
],
"invite": [
"дроу",
"Привет.",
"ку",
"qq",
"вечер в хату",
"привет я даня 13 лет пошлый........",
"welcome to the club, buddy *slap*",
"выйди нахуй",
"вы кто такие? я вас не звал. идите нахуй",
"приветики",
"дратути)0))0",
"привет 🌚"
],
"dayPidor": [
"взламываю пентагон",
"чешу репу",
"компилирую вкм",
"ебу Ризвана",
"глажу себя по животику",
"решаю интегралы",
"провожу сложный математический анализ",
"изучаю небо",
"удаляю программу вконтакте",
"ломаю дата-центры",
"жму руку Дурову",
"смотрю сериалы",
"сплю",
"багую",
"режу вены",
"кушаю",
"ковыряюсь в носу",
"опять долблю Ризвана",
"делаю дз",
"чиллю",
"слушаю музыку",
"прокрастинирую",
"обрываю важные кабели",
"изучаю dagger2",
"решаю квадратное уравнение через теорему Виета",
"облизываю пальчики",
"провожу кастинг ♂dungeon master♂"
]
}
+201
View File
@@ -0,0 +1,201 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const si = require("systeminformation");
exports.IS_DEBUG = true;
exports.CREATOR_ID = 0;
exports.startTime = 0;
exports.systemSpecsText = '';
exports.testAnswer = true;
exports.checkMom = true;
exports.checkDad = true;
exports.biteDick = true;
exports.messagesReceived = 0;
exports.messagesSent = 0;
exports.testAnswers = [];
function upReceivedMessages() {
exports.messagesReceived++;
}
exports.upReceivedMessages = upReceivedMessages;
function upSentMessages() {
exports.messagesSent++;
}
exports.upSentMessages = upSentMessages;
function setTestAnswers(answers) {
this.testAnswers = answers;
}
exports.setTestAnswers = setTestAnswers;
function setStartTime(startTime) {
this.startTime = startTime;
}
exports.setStartTime = setStartTime;
function initSystemSpecs() {
let text = '';
si.osInfo().then(async (os) => {
text += `OS: ${os.distro}\n`;
si.cpu().then(async (cpu) => {
text += `CPU: ${cpu.manufacturer} ${cpu.brand} ${cpu.physicalCores} cores ${cpu.cores} threads\n`;
si.mem().then(async (memory) => {
const totalRam = Math.round(memory.total / Math.pow(2, 30));
text += `RAM: ${totalRam} GB\n`;
exports.systemSpecsText = text;
});
});
});
}
exports.initSystemSpecs = initSystemSpecs;
class Chat {
}
exports.Chat = Chat;
class From {
}
exports.From = From;
class Message {
}
exports.Message = Message;
class MessageContext {
hasInvitedMembers() {
return !!this.message.new_chat_members;
}
hasLeftMembers() {
return !!this.message.left_chat_member;
}
isChat() {
return this.message.chat.type !== 'private';
}
getFullSenderTitle() {
return this.message.from.firstName + (this.message.from.lastName ? ' ' + this.message.from.lastName : '');
}
getFullChatTitle() {
return this.message.chat.firstName + (this.message.chat.lastName ? ' ' + this.message.chat.lastName : '');
}
hasRepliedMessage() {
return !!this.message.reply_to_message;
}
}
exports.MessageContext = MessageContext;
function prepareMessageContext(rawMessage) {
if (!rawMessage)
return null;
const context = new MessageContext();
context.message = this.prepareMessage(rawMessage);
context.senderId = context.message.from.id;
context.chatId = context.message.chat.id;
context.invitedMembers = context.message.new_chat_members;
context.leftMember = context.message.left_chat_member;
context.reply = rawMessage.reply;
if (context.message.reply_to_message !== null)
context.repliedMessage = this.prepareMessageContext(rawMessage.reply_to_message);
context.text = context.message.body;
return context;
}
exports.prepareMessageContext = prepareMessageContext;
function prepareMessage(rawMessage) {
if (!rawMessage)
return null;
const message = new Message();
message.id = rawMessage.message_id;
message.date = rawMessage.date;
message.body = rawMessage.text;
message.new_chat_members = rawMessage.new_chat_members;
message.left_chat_member = rawMessage.left_chat_member;
const from = new From();
from.id = rawMessage.from.id;
from.isBot = rawMessage.from.is_bot;
from.firstName = rawMessage.from.first_name;
from.lastName = rawMessage.from.last_name;
from.username = rawMessage.from.username;
message.from = from;
const chat = new Chat();
chat.id = rawMessage.chat.id;
chat.firstName = rawMessage.chat.first_name;
chat.lastName = rawMessage.chat.last_name;
chat.username = rawMessage.chat.username;
chat.type = rawMessage.chat.type;
message.chat = chat;
if (rawMessage.reply_to_message)
message.reply_to_message = this.prepareMessage(rawMessage.reply_to_message);
return message;
}
exports.prepareMessage = prepareMessage;
function includes(array, object) {
return array.indexOf(object) > -1;
}
exports.includes = includes;
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
exports.getRandomInt = getRandomInt;
function arrayRemove(arr, value) {
return arr.filter(function (ele) {
return ele != value;
});
}
exports.arrayRemove = arrayRemove;
function deepEqual(object1, object2) {
if ((object1 == null || object2 == null) && object1 != object2)
return false;
const keys1 = Object.keys(object1);
const keys2 = Object.keys(object2);
if (keys1.length !== keys2.length) {
return false;
}
for (const key of keys1) {
const val1 = object1[key];
const val2 = object2[key];
const areObjects = isObject(val1) && isObject(val2);
if (areObjects && !deepEqual(val1, val2) ||
!areObjects && val1 !== val2) {
return false;
}
}
return true;
}
exports.deepEqual = deepEqual;
function isObject(object) {
return object != null && typeof object === 'object';
}
exports.isObject = isObject;
function getUptime() {
const processSeconds = Math.ceil(process.uptime());
let minutes = 0;
let hours = 0;
let days = 0;
let i = 0;
let seconds = 0;
while (i < processSeconds) {
i++;
seconds++;
if (seconds == 60) {
minutes++;
seconds = 0;
}
if (minutes == 60) {
hours++;
minutes = 0;
}
if (hours == 24) {
days++;
hours = 0;
}
}
let text = '';
if (days > 0)
text += `${days} д. `;
if (hours > 0)
text += `${hours} ч. `;
if (minutes > 0)
text += `${minutes} м. `;
if (seconds > 0)
text += `${seconds} с. `;
return text;
}
exports.getUptime = getUptime;
function getExceptionText(e) {
return `Произошел троллинг
* Error : ${e.name}
* Message : ${e.message}
* StackTrace :
${e.stack}`;
}
exports.getExceptionText = getExceptionText;
//# sourceMappingURL=base.js.map
+1
View File
File diff suppressed because one or more lines are too long
+261
View File
@@ -0,0 +1,261 @@
import * as si from 'systeminformation'
export const IS_DEBUG: boolean = true
export const CREATOR_ID: number = 0
export let startTime: number = 0
export let systemSpecsText: string = ''
export let testAnswer: boolean = true
export let checkMom: boolean = true
export let checkDad: boolean = true
export let biteDick: boolean = true
export let messagesReceived = 0
export let messagesSent = 0
export let testAnswers: string[] = []
export function upReceivedMessages() {
messagesReceived++
}
export function upSentMessages() {
messagesSent++
}
export function setTestAnswers(answers: string[]) {
this.testAnswers = answers
}
export function setStartTime(startTime: number) {
this.startTime = startTime
}
export function initSystemSpecs() {
let text = ''
si.osInfo().then(async (os) => {
text += `OS: ${os.distro}\n`
si.cpu().then(async (cpu) => {
text += `CPU: ${cpu.manufacturer} ${cpu.brand} ${cpu.physicalCores} cores ${cpu.cores} threads\n`
si.mem().then(async (memory) => {
const totalRam = Math.round(memory.total / Math.pow(2, 30))
text += `RAM: ${totalRam} GB\n`
systemSpecsText = text
})
})
})
}
export class Chat {
id: number
firstName: string
lastName?: string
username?: string
type: string
}
export class From {
id: number
isBot: boolean
firstName: string
lastName?: string
username?: string
}
export class Message {
id: number
from: From
chat: Chat
date: number
reply_to_message?: Message
body: string
new_chat_members?: From[]
left_chat_member?: From
}
export class MessageContext {
message: Message
reply: any
senderId: number
chatId: number
repliedMessage?: MessageContext
text: string
invitedMembers?: From[]
leftMember?: From
hasInvitedMembers(): boolean {
return !!this.message.new_chat_members
}
hasLeftMembers(): boolean {
return !!this.message.left_chat_member
}
isChat(): boolean {
return this.message.chat.type !== 'private'
}
getFullSenderTitle(): string {
return this.message.from.firstName + (this.message.from.lastName ? ' ' + this.message.from.lastName : '')
}
getFullChatTitle(): string {
return this.message.chat.firstName + (this.message.chat.lastName ? ' ' + this.message.chat.lastName : '')
}
hasRepliedMessage(): boolean {
return !!this.message.reply_to_message
}
}
export function prepareMessageContext(rawMessage: any): MessageContext {
if (!rawMessage) return null
const context = new MessageContext()
context.message = this.prepareMessage(rawMessage)
context.senderId = context.message.from.id
context.chatId = context.message.chat.id
context.invitedMembers = context.message.new_chat_members
context.leftMember = context.message.left_chat_member
context.reply = rawMessage.reply
if (context.message.reply_to_message !== null)
context.repliedMessage = this.prepareMessageContext(rawMessage.reply_to_message)
context.text = context.message.body
return context
}
export function prepareMessage(rawMessage: any) {
if (!rawMessage) return null
const message = new Message()
message.id = rawMessage.message_id
message.date = rawMessage.date
message.body = rawMessage.text
message.new_chat_members = rawMessage.new_chat_members
message.left_chat_member = rawMessage.left_chat_member
const from = new From()
from.id = rawMessage.from.id
from.isBot = rawMessage.from.is_bot
from.firstName = rawMessage.from.first_name
from.lastName = rawMessage.from.last_name
from.username = rawMessage.from.username
message.from = from
const chat = new Chat()
chat.id = rawMessage.chat.id
chat.firstName = rawMessage.chat.first_name
chat.lastName = rawMessage.chat.last_name
chat.username = rawMessage.chat.username
chat.type = rawMessage.chat.type
message.chat = chat
if (rawMessage.reply_to_message) message.reply_to_message = this.prepareMessage(rawMessage.reply_to_message)
return message
}
export function includes(array: any[], object: any) {
return array.indexOf(object) > -1
}
export function getRandomInt(max: number) {
return Math.floor(Math.random() * Math.floor(max));
}
export function arrayRemove(arr: any[], value: any) {
return arr.filter(function (ele: any) {
return ele != value;
});
}
export function deepEqual(object1: { [x: string]: any }, object2: { [x: string]: any; year?: number; month?: number; day?: number }) {
if ((object1 == null || object2 == null) && object1 != object2) return false
const keys1 = Object.keys(object1);
const keys2 = Object.keys(object2);
if (keys1.length !== keys2.length) {
return false;
}
for (const key of keys1) {
const val1 = object1[key];
const val2 = object2[key];
const areObjects = isObject(val1) && isObject(val2);
if (
areObjects && !deepEqual(val1, val2) ||
!areObjects && val1 !== val2
) {
return false;
}
}
return true;
}
export function isObject(object: any) {
return object != null && typeof object === 'object';
}
export function getUptime() {
const processSeconds = Math.ceil(process.uptime())
let minutes = 0
let hours = 0
let days = 0
let i = 0
let seconds = 0
while (i < processSeconds) {
i++
seconds++
if (seconds == 60) {
minutes++
seconds = 0
}
if (minutes == 60) {
hours++
minutes = 0
}
if (hours == 24) {
days++
hours = 0
}
}
let text = ''
if (days > 0) text += `${days} д. `
if (hours > 0) text += `${hours} ч. `
if (minutes > 0) text += `${minutes} м. `
if (seconds > 0) text += `${seconds} с. `
return text
}
export function getExceptionText(e: Error) {
return `Произошел троллинг
* Error : ${e.name}
* Message : ${e.message}
* StackTrace :
${e.stack}`
}
+105
View File
@@ -0,0 +1,105 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const base_1 = require("./base");
exports.adminsList = [];
exports.chatsList = [];
exports.usersList = [];
exports.notesList = [];
exports.mutedList = [];
let jsonFile;
function setAdmins(admins) {
exports.adminsList = admins;
}
exports.setAdmins = setAdmins;
function setChats(chats) {
exports.chatsList = chats;
}
exports.setChats = setChats;
function setUsers(users) {
exports.usersList = users;
}
exports.setUsers = setUsers;
function setNotes(notes) {
exports.notesList = notes;
}
exports.setNotes = setNotes;
function setMuted(newMuted) {
exports.mutedList = newMuted;
}
exports.setMuted = setMuted;
function addMute(id) {
const index = searchMuted(id);
if (index >= 0)
return false;
exports.mutedList.push(id);
saveData();
return true;
}
exports.addMute = addMute;
function removeMute(id) {
const index = searchMuted(id);
if (index >= 0) {
setMuted(base_1.arrayRemove(exports.mutedList, exports.mutedList[index]));
saveData();
return true;
}
return false;
}
exports.removeMute = removeMute;
function searchMuted(id) {
for (let i = 0; i < exports.mutedList.length; i++) {
if (exports.mutedList[i] == id)
return i;
}
return -1;
}
exports.searchMuted = searchMuted;
function readData() {
try {
// @ts-ignore
jsonFile = JSON.parse(fs.readFileSync(base_1.IS_DEBUG ? 'debug_data.json' : 'data.json'));
exports.adminsList = jsonFile.admins;
exports.chatsList = jsonFile.chats;
exports.usersList = jsonFile.users;
exports.notesList = jsonFile.notes;
exports.mutedList = jsonFile.muted;
return 'success';
}
catch (e) {
console.error(e);
return e.toString();
}
}
exports.readData = readData;
function saveData() {
jsonFile.admins = exports.adminsList;
jsonFile.chats = exports.chatsList;
jsonFile.users = exports.usersList;
jsonFile.notes = exports.notesList;
jsonFile.muted = exports.mutedList;
fs.writeFileSync(base_1.IS_DEBUG ? 'debug_data.json' : 'data.json', JSON.stringify(jsonFile));
readData();
return 'success';
}
exports.saveData = saveData;
function retrieveAnswers() {
try {
// @ts-ignore
const json = JSON.parse(fs.readFileSync('answers.json'));
base_1.setTestAnswers(json.test);
return 'success';
}
catch (e) {
console.error(e);
return e.toString();
}
// fetch(answersUrl, {method: "Get"})
// .then(r => {
// const json = r.json()
// testAnswers = json.test
// console.log('success retrieved answers')
// })
}
exports.retrieveAnswers = retrieveAnswers;
//# sourceMappingURL=db.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"db.js","sourceRoot":"","sources":["db.ts"],"names":[],"mappings":";;AAAA,yBAAyB;AACzB,iCAA6D;AAElD,QAAA,UAAU,GAAa,EAAE,CAAA;AACzB,QAAA,SAAS,GAAG,EAAE,CAAA;AACd,QAAA,SAAS,GAAG,EAAE,CAAA;AACd,QAAA,SAAS,GAAG,EAAE,CAAA;AACd,QAAA,SAAS,GAAa,EAAE,CAAA;AAEnC,IAAI,QAAQ,CAAA;AAEZ,SAAgB,SAAS,CAAC,MAAgB;IACtC,kBAAU,GAAG,MAAM,CAAA;AACvB,CAAC;AAFD,8BAEC;AAED,SAAgB,QAAQ,CAAC,KAAY;IACjC,iBAAS,GAAG,KAAK,CAAA;AACrB,CAAC;AAFD,4BAEC;AAED,SAAgB,QAAQ,CAAC,KAAY;IACjC,iBAAS,GAAG,KAAK,CAAA;AACrB,CAAC;AAFD,4BAEC;AAED,SAAgB,QAAQ,CAAC,KAAY;IACjC,iBAAS,GAAG,KAAK,CAAA;AACrB,CAAC;AAFD,4BAEC;AAED,SAAgB,QAAQ,CAAC,QAAkB;IACvC,iBAAS,GAAG,QAAQ,CAAA;AACxB,CAAC;AAFD,4BAEC;AAED,SAAgB,OAAO,CAAC,EAAU;IAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,CAAC,CAAA;IAC7B,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IAE5B,iBAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAElB,QAAQ,EAAE,CAAA;IACV,OAAO,IAAI,CAAA;AACf,CAAC;AARD,0BAQC;AAED,SAAgB,UAAU,CAAC,EAAU;IACjC,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,CAAC,CAAA;IAE7B,IAAI,KAAK,IAAI,CAAC,EAAE;QACZ,QAAQ,CAAC,kBAAW,CAAC,iBAAS,EAAE,iBAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAClD,QAAQ,EAAE,CAAA;QACV,OAAO,IAAI,CAAA;KACd;IAED,OAAO,KAAK,CAAA;AAChB,CAAC;AAVD,gCAUC;AAED,SAAgB,WAAW,CAAC,EAAU;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACvC,IAAI,iBAAS,CAAC,CAAC,CAAC,IAAI,EAAE;YAAE,OAAO,CAAC,CAAA;KACnC;IAED,OAAO,CAAC,CAAC,CAAA;AACb,CAAC;AAND,kCAMC;AAED,SAAgB,QAAQ;IACpB,IAAI;QACA,aAAa;QACb,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAA;QAElF,kBAAU,GAAG,QAAQ,CAAC,MAAM,CAAA;QAC5B,iBAAS,GAAG,QAAQ,CAAC,KAAK,CAAA;QAC1B,iBAAS,GAAG,QAAQ,CAAC,KAAK,CAAA;QAC1B,iBAAS,GAAG,QAAQ,CAAC,KAAK,CAAA;QAC1B,iBAAS,GAAG,QAAQ,CAAC,KAAK,CAAA;QAE1B,OAAO,SAAS,CAAA;KACnB;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAChB,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAA;KACtB;AACL,CAAC;AAhBD,4BAgBC;AAED,SAAgB,QAAQ;IACpB,QAAQ,CAAC,MAAM,GAAG,kBAAU,CAAA;IAC5B,QAAQ,CAAC,KAAK,GAAG,iBAAS,CAAA;IAC1B,QAAQ,CAAC,KAAK,GAAG,iBAAS,CAAA;IAC1B,QAAQ,CAAC,KAAK,GAAG,iBAAS,CAAA;IAC1B,QAAQ,CAAC,KAAK,GAAG,iBAAS,CAAA;IAE1B,EAAE,CAAC,aAAa,CAAC,eAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEtF,QAAQ,EAAE,CAAA;IAEV,OAAO,SAAS,CAAA;AACpB,CAAC;AAZD,4BAYC;AAED,SAAgB,eAAe;IAC3B,IAAI;QACA,aAAa;QACb,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAA;QAExD,qBAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACzB,OAAO,SAAS,CAAA;KACnB;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAChB,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAA;KACtB;IAED,qCAAqC;IACrC,mBAAmB;IACnB,gCAAgC;IAChC,kCAAkC;IAClC,mDAAmD;IACnD,SAAS;AACb,CAAC;AAlBD,0CAkBC"}
+112
View File
@@ -0,0 +1,112 @@
import * as fs from "fs";
import {arrayRemove, IS_DEBUG, setTestAnswers} from "./base";
export let adminsList: number[] = []
export let chatsList = []
export let usersList = []
export let notesList = []
export let mutedList: number[] = []
let jsonFile
export function setAdmins(admins: number[]) {
adminsList = admins
}
export function setChats(chats: any[]) {
chatsList = chats
}
export function setUsers(users: any[]) {
usersList = users
}
export function setNotes(notes: any[]) {
notesList = notes
}
export function setMuted(newMuted: number[]) {
mutedList = newMuted
}
export function addMute(id: number) {
const index = searchMuted(id)
if (index >= 0) return false
mutedList.push(id)
saveData()
return true
}
export function removeMute(id: number) {
const index = searchMuted(id)
if (index >= 0) {
setMuted(arrayRemove(mutedList, mutedList[index]))
saveData()
return true
}
return false
}
export function searchMuted(id: number) {
for (let i = 0; i < mutedList.length; i++) {
if (mutedList[i] == id) return i
}
return -1
}
export function readData() {
try {
// @ts-ignore
jsonFile = JSON.parse(fs.readFileSync(IS_DEBUG ? 'debug_data.json' : 'data.json'))
adminsList = jsonFile.admins
chatsList = jsonFile.chats
usersList = jsonFile.users
notesList = jsonFile.notes
mutedList = jsonFile.muted
return 'success'
} catch (e) {
console.error(e)
return e.toString()
}
}
export function saveData() {
jsonFile.admins = adminsList
jsonFile.chats = chatsList
jsonFile.users = usersList
jsonFile.notes = notesList
jsonFile.muted = mutedList
fs.writeFileSync(IS_DEBUG ? 'debug_data.json' : 'data.json', JSON.stringify(jsonFile))
readData()
return 'success'
}
export function retrieveAnswers() {
try {
// @ts-ignore
const json = JSON.parse(fs.readFileSync('answers.json'))
setTestAnswers(json.test)
return 'success'
} catch (e) {
console.error(e)
return e.toString()
}
// fetch(answersUrl, {method: "Get"})
// .then(r => {
// const json = r.json()
// testAnswers = json.test
// console.log('success retrieved answers')
// })
}
+26
View File
@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const TeleBot = require("telebot");
const base_1 = require("./base");
const commands_1 = require("../commands/base/commands");
exports.bot = new TeleBot('1640683270:AAFc4yIbeF_ofkcPtD8U9ReRXZ754rlxYrw');
function startBot() {
exports.bot.on('*', async (rawMessage) => {
base_1.upReceivedMessages();
console.log(rawMessage);
const context = base_1.prepareMessageContext(rawMessage);
if (context.hasInvitedMembers()) {
return;
}
await commands_1.parseCommands(context);
});
exports.bot.start();
}
exports.startBot = startBot;
async function sendMessage(context, text) {
return await exports.bot.sendMessage(context.chatId, text).then(() => {
base_1.upSentMessages();
});
}
exports.sendMessage = sendMessage;
//# sourceMappingURL=net.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"net.js","sourceRoot":"","sources":["net.ts"],"names":[],"mappings":";;AAAA,mCAAkC;AAClC,iCAAiG;AACjG,wDAAwD;AAE3C,QAAA,GAAG,GAAG,IAAI,OAAO,CAAC,gDAAgD,CAAC,CAAA;AAEhF,SAAgB,QAAQ;IACpB,WAAG,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,UAAe,EAAE,EAAE;QAClC,yBAAkB,EAAE,CAAA;QAEpB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QAEvB,MAAM,OAAO,GAAG,4BAAqB,CAAC,UAAU,CAAC,CAAA;QAEjD,IAAI,OAAO,CAAC,iBAAiB,EAAE,EAAE;YAE7B,OAAM;SACT;QAED,MAAM,wBAAa,CAAC,OAAO,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,WAAG,CAAC,KAAK,EAAE,CAAA;AACf,CAAC;AAjBD,4BAiBC;AAEM,KAAK,UAAU,WAAW,CAAC,OAAuB,EAAE,IAAY;IACnE,OAAO,MAAM,WAAG,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACzD,qBAAc,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;AACN,CAAC;AAJD,kCAIC"}
+30
View File
@@ -0,0 +1,30 @@
import * as TeleBot from 'telebot'
import {MessageContext, prepareMessageContext, upReceivedMessages, upSentMessages} from "./base";
import {parseCommands} from "../commands/base/commands";
export const bot = new TeleBot('1640683270:AAFc4yIbeF_ofkcPtD8U9ReRXZ754rlxYrw')
export function startBot() {
bot.on('*', async (rawMessage: any) => {
upReceivedMessages()
console.log(rawMessage)
const context = prepareMessageContext(rawMessage)
if (context.hasInvitedMembers()) {
return
}
await parseCommands(context)
})
bot.start()
}
export async function sendMessage(context: MessageContext, text: string): Promise<any> {
return await bot.sendMessage(context.chatId, text).then(() => {
upSentMessages()
})
}
+4
View File
@@ -0,0 +1,4 @@
{
"_from": "base",
"_location": "/base"
}
+28
View File
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const net_1 = require("../base/net");
class Ae {
constructor() {
this.regexp = /^\/ae\s([^]+)/i;
}
async execute(context, params) {
const match = params[1];
try {
let e = eval(match);
e = ((typeof e == 'string') ? e : JSON.stringify(e));
await net_1.sendMessage(context, e);
}
catch (e) {
const text = e.message.toString();
if (text.includes('is not defined')) {
await net_1.sendMessage(context, 'variable is not defined');
return;
}
console.error(`${text}
* Stacktrace: ${e.stack}`);
await net_1.sendMessage(context, text);
}
}
}
exports.Ae = Ae;
//# sourceMappingURL=ae.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"ae.js","sourceRoot":"","sources":["ae.ts"],"names":[],"mappings":";;AACA,qCAAwC;AAGxC,MAAa,EAAE;IAAf;QACI,WAAM,GAAG,gBAAgB,CAAA;IA4B7B,CAAC;IAvBG,KAAK,CAAC,OAAO,CAAC,OAAuB,EAAE,MAAgB;QACnD,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QAEvB,IAAI;YACA,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;YAEnB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;YAEpD,MAAM,iBAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;SAChC;QAAC,OAAO,CAAC,EAAE;YACR,MAAM,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAA;YAEjC,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;gBACjC,MAAM,iBAAW,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAA;gBACrD,OAAM;aACT;YAED,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;gCACD,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;YAE9B,MAAM,iBAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;SACnC;IACL,CAAC;CACJ;AA7BD,gBA6BC"}
+34
View File
@@ -0,0 +1,34 @@
import {Command} from "./base/command";
import {sendMessage} from "../base/net";
import {MessageContext} from "../base/base";
export class Ae implements Command {
regexp = /^\/ae\s([^]+)/i
title: '/ae'
description: 'eval'
requireAdmin: true
async execute(context: MessageContext, params: string[]) {
const match = params[1]
try {
let e = eval(match)
e = ((typeof e == 'string') ? e : JSON.stringify(e))
await sendMessage(context, e)
} catch (e) {
const text = e.message.toString()
if (text.includes('is not defined')) {
await sendMessage(context, 'variable is not defined')
return
}
console.error(`${text}
* Stacktrace: ${e.stack}`)
await sendMessage(context, text)
}
}
}
+13
View File
@@ -0,0 +1,13 @@
import {MessageContext} from "../../base/base";
export declare class Command {
regexp: RegExp
title?: string
description?: string
requireAdmin?: boolean
requireReply?: boolean
requireCreator?: boolean
requireChat?: boolean
execute: (context: MessageContext, params: string[], reply?: MessageContext) => {}
}
+54
View File
@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("../../base/base");
const db_1 = require("../../base/db");
const net_1 = require("../../base/net");
const test_1 = require("../test");
const help_1 = require("../help");
const ae_1 = require("../ae");
const dad_1 = require("../dad");
const fuckYou_1 = require("../fuckYou");
const mom_1 = require("../mom");
const mute_1 = require("../mute");
const unmute_1 = require("../unmute");
const ping_1 = require("../ping");
const q_1 = require("../q");
const randomString_1 = require("../randomString");
const systemSpecs_1 = require("../systemSpecs");
async function parseCommands(context) {
try {
const cmd = searchCommand(context);
if (!cmd ||
(cmd.requireChat && !context.isChat()) ||
(cmd.requireReply && !context.hasRepliedMessage()))
return;
if ((cmd.requireCreator && context.senderId != base_1.CREATOR_ID) ||
(cmd.requireAdmin && !base_1.includes(db_1.adminsList, context.senderId))) {
await net_1.sendMessage(context, 'У вас нет доступа');
return;
}
cmd.execute(context, context.text.match(cmd.regexp), context.repliedMessage);
}
catch (e) {
console.log(base_1.getExceptionText(e));
}
function searchCommand(message, text) {
return commands.find(c => c.regexp.test(message ? message.text : text));
}
}
exports.parseCommands = parseCommands;
let commands = [
new ae_1.Ae(),
new dad_1.Dad(),
new fuckYou_1.FuckYou(),
new help_1.Help(),
new mom_1.Mom(),
new mute_1.Mute(),
new unmute_1.Unmute(),
new ping_1.Ping(),
new q_1.Q(),
new randomString_1.RandomString(),
new systemSpecs_1.SystemSpecs(),
new test_1.Test()
];
//# sourceMappingURL=commands.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"commands.js","sourceRoot":"","sources":["commands.ts"],"names":[],"mappings":";;AAAA,0CAAuF;AAEvF,sCAAyC;AACzC,wCAA2C;AAC3C,kCAA6B;AAC7B,kCAA6B;AAC7B,8BAAyB;AACzB,gCAA2B;AAC3B,wCAAmC;AACnC,gCAA2B;AAC3B,kCAA6B;AAC7B,sCAAiC;AACjC,kCAA6B;AAC7B,4BAAuB;AACvB,kDAA6C;AAC7C,gDAA2C;AAEpC,KAAK,UAAU,aAAa,CAAC,OAAuB;IACvD,IAAI;QACA,MAAM,GAAG,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;QAElC,IAAI,CAAC,GAAG;YACJ,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACtC,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;YAAE,OAAM;QAE9D,IAAI,CAAC,GAAG,CAAC,cAAc,IAAI,OAAO,CAAC,QAAQ,IAAI,iBAAU,CAAC;YACtD,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,eAAQ,CAAC,eAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE;YAE/D,MAAM,iBAAW,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAA;YAC/C,OAAM;SACT;QAED,GAAG,CAAC,OAAO,CACP,OAAO,EACP,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAC9B,OAAO,CAAC,cAAc,CACzB,CAAA;KACJ;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,GAAG,CAAC,uBAAgB,CAAC,CAAC,CAAC,CAAC,CAAA;KACnC;IAED,SAAS,aAAa,CAAC,OAAO,EAAE,IAAa;QACzC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3E,CAAC;AACL,CAAC;AA3BD,sCA2BC;AAED,IAAI,QAAQ,GAAc;IACtB,IAAI,OAAE,EAAE;IACR,IAAI,SAAG,EAAE;IACT,IAAI,iBAAO,EAAE;IACb,IAAI,WAAI,EAAE;IACV,IAAI,SAAG,EAAE;IACT,IAAI,WAAI,EAAE;IACV,IAAI,eAAM,EAAE;IACZ,IAAI,WAAI,EAAE;IACV,IAAI,KAAC,EAAE;IACP,IAAI,2BAAY,EAAE;IAClB,IAAI,yBAAW,EAAE;IACjB,IAAI,WAAI,EAAE;CACb,CAAA"}
+60
View File
@@ -0,0 +1,60 @@
import {CREATOR_ID, getExceptionText, includes, MessageContext} from "../../base/base";
import {Command} from "./command";
import {adminsList} from "../../base/db";
import {sendMessage} from "../../base/net";
import {Test} from "../test";
import {Help} from "../help";
import {Ae} from "../ae";
import {Dad} from "../dad";
import {FuckYou} from "../fuckYou";
import {Mom} from "../mom";
import {Mute} from "../mute";
import {Unmute} from "../unmute";
import {Ping} from "../ping";
import {Q} from "../q";
import {RandomString} from "../randomString";
import {SystemSpecs} from "../systemSpecs";
export async function parseCommands(context: MessageContext) {
try {
const cmd = searchCommand(context)
if (!cmd ||
(cmd.requireChat && !context.isChat()) ||
(cmd.requireReply && !context.hasRepliedMessage())) return
if ((cmd.requireCreator && context.senderId != CREATOR_ID) ||
(cmd.requireAdmin && !includes(adminsList, context.senderId))) {
await sendMessage(context, 'У вас нет доступа')
return
}
cmd.execute(
context,
context.text.match(cmd.regexp),
context.repliedMessage
)
} catch (e) {
console.log(getExceptionText(e))
}
function searchCommand(message, text?: string): Command {
return commands.find(c => c.regexp.test(message ? message.text : text))
}
}
let commands: Command[] = [
new Ae(),
new Dad(),
new FuckYou(),
new Help(),
new Mom(),
new Mute(),
new Unmute(),
new Ping(),
new Q(),
new RandomString(),
new SystemSpecs(),
new Test()
]
+15
View File
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("../../base/base");
const net_1 = require("../../base/net");
class Stats {
constructor() {
this.regexp = /^\/stats/i;
}
async execute(context) {
const text = `Статистика бота.\n\n⏳ Время работы: ${base_1.getUptime()}\n📥 Сообщений получено: ${base_1.messagesReceived}\n📤 Сообщений отправлено: ${base_1.messagesSent}`;
await net_1.sendMessage(context, text);
}
}
exports.Stats = Stats;
//# sourceMappingURL=stats.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"stats.js","sourceRoot":"","sources":["stats.ts"],"names":[],"mappings":";;AACA,0CAA0F;AAC1F,wCAA2C;AAE3C,MAAa,KAAK;IAAlB;QACI,WAAM,GAAG,WAAW,CAAA;IASxB,CAAC;IALG,KAAK,CAAC,OAAO,CAAC,OAAuB;QACjC,MAAM,IAAI,GAAG,uCAAuC,gBAAS,EAAE,4BAA4B,uBAAgB,8BAA8B,mBAAY,EAAE,CAAA;QACvJ,MAAM,iBAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IACpC,CAAC;CAEJ;AAVD,sBAUC"}
+15
View File
@@ -0,0 +1,15 @@
import {Command} from "./command";
import {getUptime, MessageContext, messagesReceived, messagesSent} from "../../base/base";
import {sendMessage} from "../../base/net";
export class Stats implements Command {
regexp = /^\/stats/i
title: '/stats'
description: 'статистика бота'
async execute(context: MessageContext) {
const text = `Статистика бота.\n\n⏳ Время работы: ${getUptime()}\n📥 Сообщений получено: ${messagesReceived}\n📤 Сообщений отправлено: ${messagesSent}`
await sendMessage(context, text)
}
}
+16
View File
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("../base/base");
const net_1 = require("../base/net");
class Dad {
constructor() {
this.regexp = /бат(ь|я|ька|ёк)/i;
}
async execute(context) {
if (!base_1.checkDad)
return;
await net_1.sendMessage(context, 'ща втащу');
}
}
exports.Dad = Dad;
//# sourceMappingURL=dad.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"dad.js","sourceRoot":"","sources":["dad.ts"],"names":[],"mappings":";;AACA,uCAAsD;AACtD,qCAAwC;AAExC,MAAa,GAAG;IAAhB;QACI,WAAM,GAAG,kBAAkB,CAAA;IAQ/B,CAAC;IALG,KAAK,CAAC,OAAO,CAAC,OAAuB;QACjC,IAAI,CAAC,eAAQ;YAAE,OAAM;QAErB,MAAM,iBAAW,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;IAC1C,CAAC;CACJ;AATD,kBASC"}
+14
View File
@@ -0,0 +1,14 @@
import {Command} from "./base/command";
import {checkDad, MessageContext} from "../base/base";
import {sendMessage} from "../base/net";
export class Dad implements Command {
regexp = /бат(ь|я|ька|ёк)/i
title: 'бать'
async execute(context: MessageContext) {
if (!checkDad) return
await sendMessage(context, 'ща втащу')
}
}
+16
View File
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("../base/base");
const net_1 = require("../base/net");
class FuckYou {
constructor() {
this.regexp = /(иди|пош([её])л)\s(нахуй|на\sхуй)/i;
}
async execute(context) {
if (!base_1.biteDick)
return;
await net_1.sendMessage(context, 'кусай за хуй');
}
}
exports.FuckYou = FuckYou;
//# sourceMappingURL=fuckYou.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"fuckYou.js","sourceRoot":"","sources":["fuckYou.ts"],"names":[],"mappings":";;AACA,uCAAsD;AACtD,qCAAwC;AAExC,MAAa,OAAO;IAApB;QACI,WAAM,GAAG,oCAAoC,CAAA;IAQjD,CAAC;IALG,KAAK,CAAC,OAAO,CAAC,OAAuB;QACjC,IAAI,CAAC,eAAQ;YAAE,OAAM;QAErB,MAAM,iBAAW,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;IAC9C,CAAC;CACJ;AATD,0BASC"}
+14
View File
@@ -0,0 +1,14 @@
import {Command} from "./base/command";
import {biteDick, MessageContext} from "../base/base";
import {sendMessage} from "../base/net";
export class FuckYou implements Command {
regexp = /(иди|пош([её])л)\s(нахуй|на\sхуй)/i
title: 'иди нахуй'
async execute(context: MessageContext) {
if (!biteDick) return
await sendMessage(context, 'кусай за хуй')
}
}
+14
View File
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const net_1 = require("../base/net");
class Help {
constructor() {
this.regexp = /^\/help/i;
}
async execute(context) {
const text = "Все вопросы к @melodaaa";
return net_1.sendMessage(context, text);
}
}
exports.Help = Help;
//# sourceMappingURL=help.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"help.js","sourceRoot":"","sources":["help.ts"],"names":[],"mappings":";;AAEA,qCAAwC;AAExC,MAAa,IAAI;IAAjB;QACI,WAAM,GAAG,UAAU,CAAA;IAWvB,CAAC;IAPG,KAAK,CAAC,OAAO,CAAC,OAAuB;QACjC,MAAM,IAAI,GAAG,yBAAyB,CAAA;QACtC,OAAO,iBAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IACrC,CAAC;CAIJ;AAZD,oBAYC"}
+17
View File
@@ -0,0 +1,17 @@
import {Command} from "./base/command";
import {MessageContext} from "../base/base";
import {sendMessage} from "../base/net";
export class Help implements Command {
regexp = /^\/help/i
title: '/help'
description: 'help'
async execute(context: MessageContext) {
const text = "Все вопросы к @melodaaa"
return sendMessage(context, text)
}
}
+16
View File
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("../base/base");
const net_1 = require("../base/net");
class Mom {
constructor() {
this.regexp = /ма(ма|му|ть|ы|ой)/i;
}
async execute(context) {
if (!base_1.checkMom)
return;
await net_1.sendMessage(context, 'мать не трож');
}
}
exports.Mom = Mom;
//# sourceMappingURL=mom.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"mom.js","sourceRoot":"","sources":["mom.ts"],"names":[],"mappings":";;AACA,uCAAsD;AACtD,qCAAwC;AAExC,MAAa,GAAG;IAAhB;QACI,WAAM,GAAG,oBAAoB,CAAA;IAQjC,CAAC;IALG,KAAK,CAAC,OAAO,CAAC,OAAuB;QACjC,IAAI,CAAC,eAAQ;YAAE,OAAM;QAErB,MAAM,iBAAW,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;IAC9C,CAAC;CACJ;AATD,kBASC"}
+14
View File
@@ -0,0 +1,14 @@
import {Command} from "./base/command";
import {checkMom, MessageContext} from "../base/base";
import {sendMessage} from "../base/net";
export class Mom implements Command {
regexp = /ма(ма|му|ть|ы|ой)/i
title: 'мать'
async execute(context: MessageContext) {
if (!checkMom) return
await sendMessage(context, 'мать не трож')
}
}
+23
View File
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const db_1 = require("../base/db");
const net_1 = require("../base/net");
class Mute {
constructor() {
this.regexp = /^\/mute/i;
}
async execute(context, params, reply) {
if (!reply)
return;
const id = context.repliedMessage.senderId;
const text = context.repliedMessage.getFullSenderTitle();
if (db_1.addMute(id)) {
await net_1.sendMessage(context, text + ' в муте! 🚫');
}
else {
await net_1.sendMessage(context, text + ' уже в муте 🤔');
}
}
}
exports.Mute = Mute;
//# sourceMappingURL=mute.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"mute.js","sourceRoot":"","sources":["mute.ts"],"names":[],"mappings":";;AACA,mCAAmC;AACnC,qCAAwC;AAGxC,MAAa,IAAI;IAAjB;QACI,WAAM,GAAG,UAAU,CAAA;IAkBvB,CAAC;IAbG,KAAK,CAAC,OAAO,CAAC,OAAuB,EAAE,MAAgB,EAAE,KAAqB;QAC1E,IAAI,CAAC,KAAK;YAAE,OAAM;QAElB,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAA;QAE1C,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAA;QAExD,IAAI,YAAO,CAAC,EAAE,CAAC,EAAE;YACb,MAAM,iBAAW,CAAC,OAAO,EAAE,IAAI,GAAG,aAAa,CAAC,CAAA;SACnD;aAAM;YACH,MAAM,iBAAW,CAAC,OAAO,EAAE,IAAI,GAAG,gBAAgB,CAAC,CAAA;SACtD;IACL,CAAC;CACJ;AAnBD,oBAmBC"}
+25
View File
@@ -0,0 +1,25 @@
import {Command} from "./base/command";
import {addMute} from "../base/db";
import {sendMessage} from "../base/net";
import {MessageContext} from "../base/base";
export class Mute implements Command {
regexp = /^\/mute/i
title: '/mute'
description: 'игнор участника со стороны бота'
requireAdmin: true
async execute(context: MessageContext, params: string[], reply: MessageContext) {
if (!reply) return
const id = context.repliedMessage.senderId
const text = context.repliedMessage.getFullSenderTitle()
if (addMute(id)) {
await sendMessage(context, text + ' в муте! 🚫')
} else {
await sendMessage(context, text + ' уже в муте 🤔')
}
}
}
+20
View File
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("../base/base");
const net_1 = require("../base/net");
class Ping {
constructor() {
this.regexp = /^\/ping/i;
}
async execute(context) {
await net_1.sendMessage(context, 'pong').then(async () => {
const nowMillis = new Date().getMilliseconds();
const change = Math.abs(nowMillis - base_1.startTime);
await net_1.sendMessage(context, `ping: ${change} ms`).then(() => {
base_1.setStartTime(0);
});
});
}
}
exports.Ping = Ping;
//# sourceMappingURL=ping.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"ping.js","sourceRoot":"","sources":["ping.ts"],"names":[],"mappings":";;AACA,uCAAqE;AACrE,qCAAwC;AAExC,MAAa,IAAI;IAAjB;QACI,WAAM,GAAG,UAAU,CAAA;IAgBvB,CAAC;IAZG,KAAK,CAAC,OAAO,CAAC,OAAuB;QACjC,MAAM,iBAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAC/C,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,eAAe,EAAE,CAAA;YAE9C,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,gBAAS,CAAC,CAAA;YAC9C,MAAM,iBAAW,CAAC,OAAO,EAAE,SAAS,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBACvD,mBAAY,CAAC,CAAC,CAAC,CAAA;YACnB,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;CAGJ;AAjBD,oBAiBC"}
+22
View File
@@ -0,0 +1,22 @@
import {Command} from "./base/command";
import {MessageContext, setStartTime, startTime} from "../base/base";
import {sendMessage} from "../base/net";
export class Ping implements Command {
regexp = /^\/ping/i
title: '/ping'
description: 'задержа между получаемым сообщением и отправленным'
async execute(context: MessageContext) {
await sendMessage(context, 'pong').then(async () => {
const nowMillis = new Date().getMilliseconds()
const change = Math.abs(nowMillis - startTime)
await sendMessage(context, `ping: ${change} ms`).then(() => {
setStartTime(0)
})
})
}
}
+14
View File
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const net_1 = require("../base/net");
class Q {
constructor() {
this.regexp = /^(\/q|умри)/i;
}
async execute(context, params, reply) {
await net_1.sendMessage(context, 'пака');
process.exit();
}
}
exports.Q = Q;
//# sourceMappingURL=q.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"q.js","sourceRoot":"","sources":["q.ts"],"names":[],"mappings":";;AACA,qCAAwC;AAGxC,MAAa,CAAC;IAAd;QACI,WAAM,GAAG,cAAc,CAAA;IAU3B,CAAC;IANG,KAAK,CAAC,OAAO,CAAC,OAAuB,EAAE,MAAgB,EAAE,KAAqB;QAC1E,MAAM,iBAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAElC,OAAO,CAAC,IAAI,EAAE,CAAA;IAClB,CAAC;CAEJ;AAXD,cAWC"}
+16
View File
@@ -0,0 +1,16 @@
import {Command} from "./base/command";
import {sendMessage} from "../base/net";
import {MessageContext} from "../base/base";
export class Q implements Command {
regexp = /^(\/q|умри)/i
title: '/q or умри'
requireAdmin: true
async execute(context: MessageContext, params: string[], reply: MessageContext) {
await sendMessage(context, 'пака')
process.exit()
}
}
+21
View File
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("../base/base");
const net_1 = require("../base/net");
class RandomString {
constructor() {
this.regexp = /^\/randomstring\s(\d+)/i;
}
async execute(context, params) {
const l = parseInt(params[1]);
const length = l > 100 && context.senderId != base_1.CREATOR_ID ? 100 : l;
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя0123456789';
for (let i = 0; i < length; i++) {
result += characters.charAt(base_1.getRandomInt(characters.length));
}
await net_1.sendMessage(context, result);
}
}
exports.RandomString = RandomString;
//# sourceMappingURL=randomString.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"randomString.js","sourceRoot":"","sources":["randomString.ts"],"names":[],"mappings":";;AACA,uCAAsE;AACtE,qCAAwC;AAExC,MAAa,YAAY;IAAzB;QACI,WAAM,GAAG,yBAAyB,CAAA;IAmBtC,CAAC;IAfG,KAAK,CAAC,OAAO,CAAC,OAAuB,EAAE,MAAgB;QACnD,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAE7B,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,IAAI,OAAO,CAAC,QAAQ,IAAI,iBAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QAElE,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,MAAM,UAAU,GAAG,kIAAkI,CAAC;QAEtJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7B,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,mBAAY,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;SAChE;QAED,MAAM,iBAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACtC,CAAC;CACJ;AApBD,oCAoBC"}
+25
View File
@@ -0,0 +1,25 @@
import {Command} from "./base/command";
import {CREATOR_ID, getRandomInt, MessageContext} from "../base/base";
import {sendMessage} from "../base/net";
export class RandomString implements Command {
regexp = /^\/randomstring\s(\d+)/i
title: '/randomString [length]'
description: 'строка из рандомных символов. Лимит 100 символов'
async execute(context: MessageContext, params: string[]) {
const l = parseInt(params[1])
const length = l > 100 && context.senderId != CREATOR_ID ? 100 : l
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя0123456789';
for (let i = 0; i < length; i++) {
result += characters.charAt(getRandomInt(characters.length));
}
await sendMessage(context, result)
}
}
+14
View File
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("../base/base");
const net_1 = require("../base/net");
class SystemSpecs {
constructor() {
this.regexp = /^\/systemspecs/i;
}
async execute(context) {
await net_1.sendMessage(context, base_1.systemSpecsText);
}
}
exports.SystemSpecs = SystemSpecs;
//# sourceMappingURL=systemSpecs.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"systemSpecs.js","sourceRoot":"","sources":["systemSpecs.ts"],"names":[],"mappings":";;AACA,uCAA6D;AAC7D,qCAAwC;AAExC,MAAa,WAAW;IAAxB;QAEI,WAAM,GAAG,iBAAiB,CAAA;IAM9B,CAAC;IAJG,KAAK,CAAC,OAAO,CAAC,OAAuB;QACjC,MAAM,iBAAW,CAAC,OAAO,EAAE,sBAAe,CAAC,CAAA;IAC/C,CAAC;CAEJ;AARD,kCAQC"}
+13
View File
@@ -0,0 +1,13 @@
import {Command} from "./base/command";
import {MessageContext, systemSpecsText} from "../base/base";
import {sendMessage} from "../base/net";
export class SystemSpecs implements Command {
regexp = /^\/systemspecs/i
async execute(context: MessageContext) {
await sendMessage(context, systemSpecsText)
}
}
+17
View File
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("../base/base");
const net_1 = require("../base/net");
class Test {
constructor() {
this.regexp = /^(test|тест|еуые|ntcn|инноке(нтий|ш|нтич))/i;
}
async execute(context) {
if (!base_1.testAnswer)
return;
const index = base_1.getRandomInt(base_1.testAnswers.length);
await net_1.sendMessage(context, base_1.testAnswers[index]);
}
}
exports.Test = Test;
//# sourceMappingURL=test.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":";;AACA,uCAAmF;AACnF,qCAAwC;AAExC,MAAa,IAAI;IAAjB;QAEI,WAAM,GAAG,6CAA6C,CAAA;IAS1D,CAAC;IAPG,KAAK,CAAC,OAAO,CAAC,OAAuB;QACjC,IAAI,CAAC,iBAAU;YAAE,OAAM;QAEvB,MAAM,KAAK,GAAG,mBAAY,CAAC,kBAAW,CAAC,MAAM,CAAC,CAAA;QAC9C,MAAM,iBAAW,CAAC,OAAO,EAAE,kBAAW,CAAC,KAAK,CAAC,CAAC,CAAA;IAClD,CAAC;CAEJ;AAXD,oBAWC"}
+16
View File
@@ -0,0 +1,16 @@
import {Command} from "./base/command";
import {getRandomInt, MessageContext, testAnswer, testAnswers} from "../base/base";
import {sendMessage} from "../base/net";
export class Test implements Command {
regexp = /^(test|тест|еуые|ntcn|инноке(нтий|ш|нтич))/i
async execute(context: MessageContext) {
if (!testAnswer) return
const index = getRandomInt(testAnswers.length)
await sendMessage(context, testAnswers[index])
}
}
+23
View File
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const db_1 = require("../base/db");
const net_1 = require("../base/net");
class Unmute {
constructor() {
this.regexp = /^\/unmute/i;
}
async execute(context, params, reply) {
if (!reply)
return;
const id = context.repliedMessage.senderId;
const text = context.repliedMessage.getFullSenderTitle();
if (db_1.removeMute(id)) {
await net_1.sendMessage(context, text + ' больше не в муте! 😁');
}
else {
await net_1.sendMessage(context, text + ' не был в муте 🤔');
}
}
}
exports.Unmute = Unmute;
//# sourceMappingURL=unmute.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"unmute.js","sourceRoot":"","sources":["unmute.ts"],"names":[],"mappings":";;AACA,mCAAsC;AACtC,qCAAwC;AAGxC,MAAa,MAAM;IAAnB;QACI,WAAM,GAAG,YAAY,CAAA;IAkBzB,CAAC;IAbG,KAAK,CAAC,OAAO,CAAC,OAAuB,EAAE,MAAgB,EAAE,KAAqB;QAC1E,IAAI,CAAC,KAAK;YAAE,OAAM;QAElB,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAA;QAE1C,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAA;QAExD,IAAI,eAAU,CAAC,EAAE,CAAC,EAAE;YAChB,MAAM,iBAAW,CAAC,OAAO,EAAE,IAAI,GAAG,uBAAuB,CAAC,CAAA;SAC7D;aAAM;YACH,MAAM,iBAAW,CAAC,OAAO,EAAE,IAAI,GAAG,mBAAmB,CAAC,CAAA;SACzD;IACL,CAAC;CACJ;AAnBD,wBAmBC"}
+25
View File
@@ -0,0 +1,25 @@
import {Command} from "./base/command";
import {removeMute} from "../base/db";
import {sendMessage} from "../base/net";
import {MessageContext} from "../base/base";
export class Unmute implements Command {
regexp = /^\/unmute/i
title: '/unmute'
description: 'удаление из мут листа'
requireAdmin: true
async execute(context: MessageContext, params: string[], reply: MessageContext) {
if (!reply) return
const id = context.repliedMessage.senderId
const text = context.repliedMessage.getFullSenderTitle()
if (removeMute(id)) {
await sendMessage(context, text + ' больше не в муте! 😁')
} else {
await sendMessage(context, text + ' не был в муте 🤔')
}
}
}
+7
View File
@@ -0,0 +1,7 @@
{
"admins": [475823381, 1686703180, 916147576],
"chats": [],
"users": [],
"notes": [],
"muted": []
}
+1
View File
@@ -0,0 +1 @@
{"admins":[475823381,1686703180,916147576],"chats":[],"users":[],"notes":[],"muted":[]}
+10
View File
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("./base/base");
const db_1 = require("./base/db");
const net_1 = require("./base/net");
base_1.initSystemSpecs();
db_1.readData();
db_1.retrieveAnswers();
net_1.startBot();
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,sCAA4C;AAC5C,kCAAoD;AACpD,oCAAoC;AAGpC,sBAAe,EAAE,CAAA;AAEjB,aAAQ,EAAE,CAAA;AACV,oBAAe,EAAE,CAAA;AACjB,cAAQ,EAAE,CAAA"}
+8 -91
View File
@@ -1,93 +1,10 @@
import TeleBot from 'telebot'
const bot = new TeleBot('916147576:AAHLLbAZOYuMvZcNs3J-ypAubLUhut0HtN0')
let banned = []
let admins = [475823381]
let uptimeS = 0
let uptimeM = 0
let uptimeH = 0
let uptimeD = 0
bot.on('text', msg => {
if (banned.includes(msg.from.id)) return
console.log(msg)
const m = msg.text
if (/ма(ма|му|ть|мы|мой|м|тер)/i.test(m)) {
return send(msg, 'мать не трож')
}
if (m == "/help") {
const text = "Все вопросы к @melod1n и @innomaxx"
return send(msg, text)
}
if (m == "/build") {
const text = "Билда нет, но вы держитесь ©"
return send(msg, text)
}
if (m == "/uptime") {
let text = ""
uptimeS = Math.floor(process.uptime())
uptimeM = Math.floor(uptimeS / 60)
uptimeH = Math.floor(uptimeM / 60)
uptimeD = Math.floor(uptimeH / 24)
if (uptimeD > 0) text += `${uptimeD} д. `
if (uptimeH > 0) text += `${uptimeH} ч. `
if (uptimeM > 0) text += `${uptimeM} м. `
if (uptimeS > 0) text += `${uptimeS} с.`
return send(msg, text)
}
if (m == "/ban" || m == "/unban") {
if (!admins.includes(msg.from.id)) {
return send(msg, "У Вас нет доступа к данной команде")
}
if (msg.reply_to_message) {
const id = msg.reply_to_message.from.id
if (id != admins[0] && id != 916147576) {
const ban = m == "/ban"
if (ban) {
if (banned.includes(id)) return send(msg, `id${id} уже забанен`)
banned.push(id)
return send(msg, `id${id} забанен`)
} else {
if (!banned.includes(id)) return send(msg, `id${id} не забанен, чтобы его можно было разбанить`)
banned.slice(0, banned.length - 2)
return send(msg, `id${id} разбанен`)
}
}
}
}
});
bot.on(/^\/ae (.+)$/, (msg, props) => {
if (!admins.includes(msg.from.id)) {
return send(msg, "У Вас нет доступа к данной команде")
}
const text = props.match[1]
return send(msg, eval(text))
});
bot.on(/^\/say (.+)$/, (msg, props) => {
const text = props.match[1]
return send(msg, text)
});
function send(msg, message) {
bot.sendMessage(msg.chat.id, message)
}
import {initSystemSpecs} from "./base/base";
import {readData, retrieveAnswers} from "./base/db";
import {startBot} from "./base/net";
bot.start()
initSystemSpecs()
readData()
retrieveAnswers()
startBot()
+21 -1
View File
@@ -1,5 +1,5 @@
{
"name": "TGBot",
"name": "tg-ts-bot",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
@@ -131,6 +131,11 @@
"mime-types": "^2.1.12"
}
},
"fs": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
"integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ="
},
"getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
@@ -217,6 +222,11 @@
"mime-db": "1.46.0"
}
},
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
},
"oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
@@ -295,6 +305,16 @@
"tweetnacl": "~0.14.0"
}
},
"systeminfo": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/systeminfo/-/systeminfo-0.0.1.tgz",
"integrity": "sha1-9hUNTAw2ZyWbaRIlwFYGbC2XJfI="
},
"systeminformation": {
"version": "5.6.1",
"resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.6.1.tgz",
"integrity": "sha512-5wJlHB4fzcrNENaqDVzy51+NlL0QRrLQ6pSRQOKl4k8v4jvYTlJUxChZYwpphk3McUw9iWPRcjdpKbTEj2Ucuw=="
},
"telebot": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/telebot/-/telebot-1.4.1.tgz",
+4
View File
@@ -3,6 +3,10 @@
"version": "1.0.0",
"dependencies": {
"@types/node": "^14.14.31",
"fs": "0.0.1-security",
"node-fetch": "^2.6.1",
"systeminfo": "0.0.1",
"systeminformation": "^5.6.1",
"telebot": "^1.4.1"
}
}
+10 -7
View File
@@ -1,8 +1,11 @@
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"sourceMap": true,
"resolveJsonModule": true
}
}
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"sourceMap": true,
"resolveJsonModule": true
},
"exclude": [
"node_modules"
]
}