Skip to content

Commit

Permalink
omg reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
mvolfik committed Dec 29, 2023
1 parent 2c3d40b commit 5ca0c68
Showing 1 changed file with 61 additions and 65 deletions.
126 changes: 61 additions & 65 deletions tgbot.deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,40 @@ async function processTgUpdate(data: any) {
return;
}

if (text.toLowerCase().includes("sex")) {
await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
const reactions = [
{ t: ["sex"], r: "🤨" },
{ t: ["rust", "růst"], r: "⚡" },
{ t: [/\bjs\b/i, "javascript"], r: "🕊" },
{ t: ["linux"], r: "🤓" },
];

for (const { t, r } of reactions) {
const trigger = t.some((x) => {
if (typeof x === "string") return text.toLowerCase().includes(x);

return x.exec(text) !== null;
});

if (!trigger) continue;

await fetch(`https://api.telegram.org/bot${token}/setMessageReaction`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
chat_id: data.message.chat.id,
reply_to_message_id: data.message.message_id,
text: `I'd just like to interject for a moment. What you're referring to as sex, is in fact, Intimate Connection, or as I've recently taken to calling it, Passion plus Sensuality. Sex is not an isolated act unto itself, but rather another natural component of a fully functioning human experience made profound by emotional connection, intimacy, and vital sensual components comprising a fulfilling relationship as defined by love.
Many individuals engage in intimate activities every day, without realizing it. Through a peculiar turn of events, the version of intimacy which is widely experienced today is often called sex, and many of its participants are not aware that it is basically the deep connection, developed by the union of hearts and souls.
There really is a sex, and these people are experiencing it, but it is just a part of the relationship they share. Intimacy is the connection: the emotional bond in the relationship that allows individuals to share their most vulnerable selves with each other. Intimacy is an essential part of human connection, but shallow without love and emotional depth; it can only function in the context of a complete relationship. Intimacy is normally experienced in combination with love: the whole experience is basically Love with Intimacy added, or Love/Intimacy. All the so-called sexual encounters are really expressions of Love/Intimacy!`,
message_id: data.message.message_id,
is_big: true,
reaction: [
{
type: "emoji",
emoji: r,
},
],
}),
});
break;
}

if (text.startsWith("/sh ") && data.message.chat.id === MAIN_CHAT_ID) {
Expand Down Expand Up @@ -180,60 +198,55 @@ There really is a sex, and these people are experiencing it, but it is just a pa
});
}

if (/(?<!GNU[+/ -])Linux/i.exec(text) !== null) {
await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
if (
text.toLowerCase().includes("gnu") &&
text.toLowerCase().includes("linux")
) {
const r1 = await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
chat_id: data.message.chat.id,
reply_to_message_id: data.message.message_id,
text: `I'd just like to interject for a moment. What you're refering to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.
text: `No, Richard, it's 'Linux', not 'GNU/Linux'. The most important contributions that the FSF made to Linux were the creation of the GPL and the GCC compiler. Those are fine and inspired products. GCC is a monumental achievement and has earned you, RMS, and the Free Software Foundation countless kudos and much appreciation.
Following are some reasons for you to mull over, including some already answered in your FAQ.
Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called Linux, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.
One guy, Linus Torvalds, used GCC to make his operating system (yes, Linux is an OS -- more on this later). He named it 'Linux' with a little help from his friends. Why doesn't he call it GNU/Linux? Because he wrote it, with more help from his friends, not you. You named your stuff, I named my stuff -- including the software I wrote using GCC -- and Linus named his stuff. The proper name is Linux because Linus Torvalds says so. Linus has spoken. Accept his authority. To do otherwise is to become a nag. You don't want to be known as a nag, do you?
There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called Linux distributions are really distributions of GNU/Linux!`,
(An operating system) != (a distribution). Linux is an operating system. By my definition, an operating system is that software which provides and limits access to hardware resources on a computer. That definition applies whereever you see Linux in use. However, Linux is usually distributed with a collection of utilities and applications to make it easily configurable as a desktop system, a server, a development box, or a graphics workstation, or whatever the user needs. In such a configuration, we have a Linux (based) distribution. Therein lies your strongest argument for the unwieldy title 'GNU/Linux' (when said bundled software is largely from the FSF). Go bug the distribution makers on that one. Take your beef to Red Hat, Mandrake, and Slackware. At least there you have an argument. Linux alone is an operating system that can be used in various applications without any GNU software whatsoever. Embedded applications come to mind as an obvious example.`,
}),
});
}

const m1 = await r1.json();

if (data.message.from.id === 656461353) {
const marian_nsfw = ['sex', 'píchat', 'pichat', 'prcat'];
let censoredText = text.toLowerCase();

for (const w of marian_nsfw) {
const regex = new RegExp(w, 'gi');
censoredText = censoredText.replace(regex, '***');
}

if (censoredText !== text.toLowerCase()) {
await fetch(`https://api.telegram.org/bot${token}/deleteMessage`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: json.stringify({
chat_id: data.message.chat.id,
message_id: data.message.message_id,
}),
});
await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: json.stringify({
chat_id: main_chat_id,
text: censoredText,
}),
});
return;
}
}
if (m1.ok) {
await new Promise((resolve) => setTimeout(resolve, 4000));
await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
chat_id: data.message.chat.id,
reply_to_message_id: m1.result.message_id,
text: `Next, even if we limit the GNU/Linux title to the GNU-based Linux distributions, we run into another obvious problem. XFree86 may well be more important to a particular Linux installation than the sum of all the GNU contributions. More properly, shouldn't the distribution be called XFree86/Linux? Or, at a minimum, XFree86/GNU/Linux? Of course, it would be rather arbitrary to draw the line there when many other fine contributions go unlisted. Yes, I know you've heard this one before. Get used to it. You'll keep hearing it until you can cleanly counter it.
if (text.toLowerCase().includes("arch") && data.message.from.id === 656461353) {
You seem to like the lines-of-code metric. There are many lines of GNU code in a typical Linux distribution. You seem to suggest that (more LOC) == (more important). However, I submit to you that raw LOC numbers do not directly correlate with importance. I would suggest that clock cycles spent on code is a better metric. For example, if my system spends 90% of its time executing XFree86 code, XFree86 is probably the single most important collection of code on my system. Even if I loaded ten times as many lines of useless bloatware on my system and I never excuted that bloatware, it certainly isn't more important code than XFree86. Obviously, this metric isn't perfect either, but LOC really, really sucks. Please refrain from using it ever again in supporting any argument.
Last, I'd like to point out that we Linux and GNU users shouldn't be fighting among ourselves over naming other people's software. But what the heck, I'm in a bad mood now. I think I'm feeling sufficiently obnoxious to make the point that GCC is so very famous and, yes, so very useful only because Linux was developed. In a show of proper respect and gratitude, shouldn't you and everyone refer to GCC as 'the Linux compiler'? Or at least, 'Linux GCC'? Seriously, where would your masterpiece be without Linux? Languishing with the HURD?
If there is a moral buried in this rant, maybe it is this:
Be grateful for your abilities and your incredible success and your considerable fame. Continue to use that success and fame for good, not evil. Also, be especially grateful for Linux' huge contribution to that success. You, RMS, the Free Software Foundation, and GNU software have reached their current high profiles largely on the back of Linux. You have changed the world. Now, go forth and don't be a nag.`,
}),
});
}
}

if (/\barch(?![ií][a-z])/i.exec(text) && data.message.from.id === 656461353) {
await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
method: "POST",
headers: {
Expand Down Expand Up @@ -302,23 +315,6 @@ if (data.message.from.id === 656461353) {
});
}

if (
(text.toLowerCase().includes("rust") ||
text.toLowerCase().includes("růst")) &&
Math.random() > 0.8
) {
await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
chat_id: data.message.chat.id,
text: Math.random() > 0.5 ? "⚡" : "🦀",
}),
});
}

if (text.toLowerCase().includes("sus")) {
await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
method: "POST",
Expand Down

0 comments on commit 5ca0c68

Please sign in to comment.