This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sessions = new Map(); | |
const chatHandler = async (ctx) => { | |
try { | |
await ctx.answerCallbackQuery(); | |
} catch {} | |
const channels = process.env.TG_CHANNEL.split(','); | |
let notJoinedChannels = []; | |
for (let channel of channels) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--ouset-cube-border-size: 10px; | |
--ouset-cube-border-color: rgb(220 38 38); | |
--inset-shadow-color-primary: rgba(0 0 0 / 0.3); | |
--inset-shadow-color-secondary: rgba(0 0 0 / 0.1); | |
--inset-margin: 30px; | |
--block-size: 200px; | |
--shape-size: 150px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bot from './setup-bot' | |
bot.hears('Hi', ctx => { | |
ctx.reply('Hi there!') | |
}) | |
export default bot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# Check image updates from Docker Hub | |
# Credits: Eddy Otsutsuki <https://github.com/hypernova7> | |
get_image_data() { | |
curl \ | |
--silent \ | |
"https://registry.hub.docker.com/v2/repositories/$1/tags?page_size=100&ordering=last_updated" | jq \ | |
-r "$2" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Telegraf } from 'telegraf' | |
import { getTextFromImage, langs } from './ocr' | |
const bot = new Telegraf(process.env.BOT_TOKEN) | |
bot.command('ocr', async ctx => { | |
const reply_to = ctx.message.reply_to_message | |
const query = ctx.message.text.replce('/ocr', '').trim() | |
if (query === 'langs') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dotenv/config'; | |
import crypto from 'node:crypto'; | |
import express from 'express'; | |
import cookieSession from 'cookie-session'; | |
import { Markup, session, Telegraf } from 'telegraf'; | |
import consola from 'consola'; | |
const logger = consola.withTag('tg-check-auth'); | |
const bot = new Telegraf(process.env.BOT_TOKEN); | |
const app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Telegraf pagination bot example | |
by @hypernova7 | |
Dependencies to install: npm i consola telegraf | |
*/ | |
import consola from 'consola' | |
import { Telegraf, Markup, session } from 'telegraf' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
@parseMD function: convert Telegram message entities to MarkdownV2 | |
Based on: https://github.com/butthx/duckbot/blob/036b1681c1a55132490a59a5cc9dea53006d0c99/src/modules/misc.ts#L1456 | |
Especial thanks ♥ to: https://github.com/butthx | |
*/ | |
function parseMD (text = '', entities = []) { | |
if (entities.length === 0) return text; | |
let cache = []; | |
const res = []; | |
const styles = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Original source: https://paste.pound-python.org/raw/QHM2XBftWwSti7Pc63JN/ | |
# Batterry monitor with dunst | |
battery_level=$(acpi -b | sed -n 's/.*\ \([[:digit:]]\{1,3\}\)\%.*/\1/;p') | |
battery_state=$(acpi -b | awk '{print $3}' | tr -d ",") | |
battery_remaining=$(acpi -b | sed -n '/Discharging/{s/^.*\ \([[:digit:]]\{2\}\)\:\([[:digit:]]\{2\}\).*/\1h \2min/;p}') | |
backlight_cmd=$(which light) | |
_battery_threshold_level="35" | |
_battery_critical_level="30" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const app = require('express')(); | |
const consola = require('consola'); | |
const logger = consola.withTag('tg-check-auth') | |
app.listen(process.env.PORT) | |
app.get('/auth', auth) | |
function auth (req, res) { | |
let status = 200 // OK code |
NewerOlder