Nandha Bot's Channel
Photo
This feature swapped to /gojo /ask commands
import aiohttp
class Gemini:
def __init__(self, api_key: str):
self.api_key = api_key
async def ask(self, prompt: str, file: dict = {}) -> dict:
async with aiohttp.ClientSession() as session:
payload = {}
payload["contents"] = []
if file:
file_uri = file["file"]["uri"]
payload["contents"].append(
{
"role": "user",
"parts": [
{
"fileData": {
"fileUri": file_uri,
"mimeType": "image/jpeg"
}
},
{
"text": prompt
}
]
}
)
else:
payload["contents"].append(
{
"role": "user",
"parts": [
{
"text": prompt
}
]
}
)
payload["generationConfig"] = {
"temperature": 0.9,
"topK": 40,
"topP": 0.95,
"maxOutputTokens": 1024,
"responseMimeType": "text/plain"
}
async with session.post(f"https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-8b-exp-0924:generateContent?key={self.api_key}", headers={"Content-Type": "application/json"}, json=payload) as response:
try:
results = await response.json()
return results
except Exception as e:
return {"error": str(e)}
async def upload_image(self, path: str) -> dict:
with open(path, "rb") as file:
async with aiohttp.ClientSession() as session:
payload = {"file": file}
async with session.post(f"https://generativelanguage.googleapis.com/upload/v1beta/files?key={self.api_key}", data=payload) as response:
try:
return await response.json()
except Exception as e:
return {"error": str(e)}
os.remove(path)
⚔️ Get your API key:
https://aistudio.google.com/app/apikey
Use @GojoAssistantBot /gemini or /google cmd replaced old model with official api
#gojoai #gemini #gojoassistant
@NandhaBots
Please open Telegram to view this post
VIEW IN TELEGRAM
👍1
Please open Telegram to view this post
VIEW IN TELEGRAM
👍2
👍3
This media is not supported in your browser
VIEW IN TELEGRAM
who won ? ☠️ In by quantity we're small but by quality we're ...
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1👍1
Forwarded from BotNews
Bot API 7.11
• Bots can now participate in revenue sharing from Telegram Ads⭐️ – unlocking a new way to help support their development.
• Introduced Paid Broadcasts⭐️ – allowing bots to broadcast up to 1000 messages per second.
• Bots can now send and receive chat-specific hashtags that only show posts and stories from a specific chat when tapped.
• Added a new inline button to let users copy text in one tap.
• Bots can now add media to existing text messages.
• And more, see the full changelog for details:
https://core.telegram.org/bots/api-changelog#october-31-2024
⚠️ Warning: Starting December 1, 2024 messages with video posted in big communities can be delayed by the server until the respective video is reencoded. Read more here.
• Bots can now participate in revenue sharing from Telegram Ads
• Introduced Paid Broadcasts
• Bots can now send and receive chat-specific hashtags that only show posts and stories from a specific chat when tapped.
• Added a new inline button to let users copy text in one tap.
• Bots can now add media to existing text messages.
• And more, see the full changelog for details:
https://core.telegram.org/bots/api-changelog#october-31-2024
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1
This media is not supported in your browser
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Nandha Bot's Channel
import requests
import json
token = ""
message_id = ...
chat_id = ...
url = f"https://api.telegram.org/bot{token}/editMessageMedia"
payload = {
"chat_id": chat_id,
"message_id": message_id,
"media": json.dumps({
"type": "photo",
"media": "" # file id or url
})
}
response = requests.post(url, data=payload)
print(response.json())
Satoru Gojo (";("
Message
It is little frustrating but we have shifted gojo to another AI. 👍
Please open Telegram to view this post
VIEW IN TELEGRAM
Satoru Gojo (";("
Message
Should we change back to our old AI version
Anonymous Poll
63%
Yes!
44%
The current version is reliable and "okay"
Added /pinterest and /pinvideo for pinterest search image & video plus downloads. #gojoAssistantBot
Example:
★
Example:
/pinvideo gojo edits
/pinterest gojo profile
★
pinterest video command updated
👍1
async def get_trendings(country: str):
base_url = "https://getdaytrends.com"
url = base_url + f'/{country}'
headers = {"user-agent": get_ua()}
# func for extract data from table
def get_result(data):
tags = data.table.find_all('tr')
results = []
for tr in tags:
src = tr.td
title = src.get_text()
link = base_url + src.a.get('href')
results.append({'title': title, 'url': link})
return results
async with aiohttp.ClientSession() as session:
try:
async with session.get(url, headers=headers) as response:
if response.status != 200:
return {'error': response.reason}
content = await response.text()
soup = BeautifulSoup(content, 'html.parser')
tables = soup.select("div[class^='inset']")
return {
'now_hashtags': get_result(tables[0]),
'today_hashtags': get_result(tables[1]),
'top_hashtags': get_result(tables[2])
}
except Exception as e:
return {'error': str(e)}
Scrapper for get top tweets tags that are trending now, today, and top in a country #NandhaBots
getdaytrends
Worldwide • Now • Twitter Trending Hashtags and Topics
HOT RIGHT NOW: #الدكتور_فهيد_بن_سالم_العجمي, あんさんぶる体操, #アルス新衣装3Dお披露目, #İmzalarHazırSaranHazır, #世界バレー... Explore all top Twitter trends and popular hashtags today Worldwide
👍1
+ Added custom welcome message module for #gojoAssistant for more detailed info use
/help welcome
Moreover if custom welcome haven't set the default welcome will come instead.
👍1