first commit

This commit is contained in:
2024-10-29 16:09:13 +03:00
commit 8bdd4be9b0
42 changed files with 2605 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import asyncio
from BITCOIN_RUB import get_location
from aiogram import Bot,Dispatcher, executor
from config import BOT_TOKEN
import requests
bitcoin_USD_STR = get_location(url='https://www.rbc.ru/crypto/currency/btcusd')
API_link = "https://api.telegram.org/bot5066611282:AAF-n8L35t-RhjH9kQbvlbucXt_q8wNQcv8"
updates = requests.get(API_link + "/getUpdates?offset=-1").json()
print(updates)
message = updates["result"][0]["message"]
chat_id = message["from"]["id"]
text = message["text"]
sent_message = requests.get(API_link + f"/sendMessage?chat_id={chat_id}&text=Привет, ты написал{text}")
sent_message = requests.get(API_link + f"/sendMessage?chat_id={chat_id}&text=Привет, курс битка{bitcoin_USD_STR}")

View File

@@ -0,0 +1,36 @@
from aiogram import Bot, Dispatcher, executor, types
from open_weather_API import
from BITCOIN_RUB import print_bitcoin
from config import BOT_TOKEN
import asyncio
import requests
bot = Bot(token=BOT_TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=['start'])
async def cmd_test(message: types.Message):
await message.reply("Hi!\nI'm Bot!\nPowered by aiogram.")
@dp.message_handler(commands="bitcoin")
async def get_coin(message: types.Message):
await message.reply(f"{print_bitcoin()}")
@dp.message_handler(content_types=['text'])
async def reaction(message: types.Message):
if message.text.lower() == "привет":
await message.answer("Здорово!!!")
elif message.text.lower() == "погода":
else:
await message.reply("Моя тебя совсем не понимать")
if __name__ == '__main__':
executor.start_polling(dp)