Skip to content

Instantly share code, notes, and snippets.

View mcpeblocker's full-sized avatar
💻
Learning

Alisher Ortiqov mcpeblocker

💻
Learning
View GitHub Profile
@mcpeblocker
mcpeblocker / sendMessage.ts
Created January 29, 2024 09:23
A script to use sendMessage method of Telegram Bot API by sending HTTP Request via axios
import axios from 'axios';
export const sendMessage = async (
botToken: string,
chatId: number,
text: string
): Promise<boolean> => {
try {
const response = await axios.post(`https://api.telegram.org/bot${botToken}/sendMessage`, {
chat_id: chatId,
@mcpeblocker
mcpeblocker / generateKey.js
Created September 16, 2022 17:57
Generate SHA1 Hash for OpenBudget validation using phone and application id.
const crypto = require("crypto");
/*
t = {
phone: "+998 (99) 345-12-12",
application: "128222"
}
*/
@mcpeblocker
mcpeblocker / spotify.js
Created September 3, 2022 12:27
Getting access_token (for Bearer auth) from spotify using your app credentials.
const client_id = "YOUR_CLIENT_ID"
const client_secret = "YOUR_CLIENT_SECRET"
const refresh_token = "YOUR_REFRESH_TOKEN"
const basic = Buffer.from(`${client_id}:${client_secret}`).toString('base64')
const TOKEN_ENDPOINT = `https://accounts.spotify.com/api/token`
const getAccessToken = async () => {
const response = await fetch(TOKEN_ENDPOINT, {
@mcpeblocker
mcpeblocker / bot.js
Created August 11, 2022 07:34
Telegraf frameworki yordamida foydalanuvchilar boshqalarga yuborgan havolalarni yoki xabarlarni sanab borish.
// @BotFather orqali inline mode va inline feedback featurelari yoqilishi shart.
const TOKEN = "";
const { Telegraf, Markup } = require('telegraf');
const bot = new Telegraf(TOKEN);
let links = [