Kings Of Python
Відкрити в Telegram
🐍 Pythonda songi va tarqalmagan kodlar kanali: @KingsOfPy ⚙️ JavaScriptda so'ngi va tarqalmagan kodlar kanali: @Kings_of_Js 🗄️DevOps uchun eng kerakli va foydali kanal @kingsofdevops Admin : @Mistrdev
Показати більше969
Підписники
Немає даних24 години
-47 днів
-4130 днів
Архів дописів
🎲 Dice rolling o'yini kodi!
🧑🏻💻 Dasturchi: @Mistrdev
🌐 Dasturlash tili: Python/Tkinter
🤖 O'quv markaz bot kodi!
🔰 Manga o'xshab Node JS ni hali endi boshlayotgan unchalik kop tajribasi yo'q bo'lgan dasturchilar uchun foydali bo'ladi deb o'ylayman!
🧑🏻💻 Dasturchi: @Mistrdev
🌐 Dasturlash tili:
JavaScript / Node JSEchobot boshqacharot varianti.
Dasturchi: @Mistrdev
Dasturlash tili: JavaScript/Node Js
#savol
bu akauntmdan kattaro narsa yuklasam bo'lmayabdi lekin boshqa akuntmdan kirb yuklasam yuklayabdi bunga nima sabab masala tg haqida
Kanalimizdagi birinchi NODE JS da yozilgan bot kodi!
Node Js ni o'rnatish 👇
https://nodejs.org/en/download
Boshlanishiga Echobotdan boshlaymiz.
Node JS da yozilgan exobot kodi.
Agar node js o'rnatilgan bo'lsa kodni ishlatish uchun:
node index.jskomandasi yetadi!
https://my.edu.uz/
https://my.maktab.uz/
https://uzbekkino.uz/uz-UZ/
https://5tashabbus.uz/
https://barakot.uz/
https://allgood.uz/
Bularni zayfliklari sotiladi.
Murojaat: @mrgayratov
Node JS da yozilgan bot kodlarini ham chiqarib tursak qarshi emasmisizlar?
require('dotenv').config()
const express = require('express')
const bodyParser = require('body-parser')
const axios = require('axios')
const {TOKEN, SERVER_URL} = process.env
console.log(TOKEN, SERVER_URL);
const TELEGRAM_API=`https://api.telegram.org/bot${TOKEN}`
const URL = `/webhook/${TOKEN}`
const WEBHOOK_URL = SERVER_URL+URL
const app = express()
app.use(bodyParser.json())
const init = async () => {
const res = await axios.get(`${TELEGRAM_API}/setWebhook?url=${WEBHOOK_URL}`)
console.log(res.data);
}
app.post(URL, async (req, res) => {
// console.log(req.body)
const chatId = req.body.message.chat.id
if (req.body.message.photo) {
const fileid = req.body.message.photo[0].file_id
await axios.post(`${TELEGRAM_API}/sendPhoto`, {
chat_id: chatId,
photo: fileid,
caption: "This is echo bot"
})
console.log(req.body.message.photo[0].file_id);
}
if (req.body.message.text) {
var text = req.body.message.text
} else {
var text = "Salom"
}
console.log(chatId);
if (text == "Qalesan") {
await axios.post(`${TELEGRAM_API}/sendMessage`, {
chat_id: chatId,
text: "Yaxshi rahmat, o'zing ham zo'rmisan"
})
}
else {
await axios.post(`${TELEGRAM_API}/sendMessage`, {
chat_id: chatId,
text: text
})
}
return res.send()
})
app.listen(process.env.PORT || 5000, async () => {
console.log("🚀 app running on port", process.env.PORT || 5000)
await init()
})from aiogram.enums import ChatType
from aiogram.filters import BaseFilter
from aiogram.types import Message
from typing import Union
class UrlChecker(BaseFilter):
def __init__(self, urls: Union[str, list]):
self.urls = urls
async def __call__(self, message: Message) -> bool:
text = message.text.lower()
for url in self.urls:
if url in text:
return True
return False