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
+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 + ' не был в муте 🤔')
}
}
}