Upload 2 files
Browse files- Akeno/plugins/id.py +93 -0
- Akeno/plugins/translate.py +48 -0
Akeno/plugins/id.py
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import asyncio
|
3 |
+
import random
|
4 |
+
import time
|
5 |
+
from pyrogram import Client, filters
|
6 |
+
from pyrogram.types import Message
|
7 |
+
from Akeno.utils.handler import *
|
8 |
+
from config import *
|
9 |
+
|
10 |
+
@Akeno(
|
11 |
+
~filters.scheduled
|
12 |
+
& filters.command(["id"], CMD_HANDLER)
|
13 |
+
& filters.me
|
14 |
+
& ~filters.forwarded
|
15 |
+
)
|
16 |
+
async def get_id(bot: Client, message: Message):
|
17 |
+
file_id = None
|
18 |
+
user_id = None
|
19 |
+
if message.reply_to_message:
|
20 |
+
rep = message.reply_to_message
|
21 |
+
if rep.audio:
|
22 |
+
file_id = f"**File ID**: `{rep.audio.file_id}`"
|
23 |
+
file_id += "**File Type**: `audio`"
|
24 |
+
elif rep.document:
|
25 |
+
file_id = f"**File ID**: `{rep.document.file_id}`"
|
26 |
+
file_id += f"**File Type**: `{rep.document.mime_type}`"
|
27 |
+
elif rep.photo:
|
28 |
+
file_id = f"**File ID**: `{rep.photo.file_id}`"
|
29 |
+
file_id += "**File Type**: `photo`"
|
30 |
+
elif rep.sticker:
|
31 |
+
file_id = f"**Sicker ID**: `{rep.sticker.file_id}`\n"
|
32 |
+
if rep.sticker.set_name and rep.sticker.emoji:
|
33 |
+
file_id += f"**Sticker Set**: `{rep.sticker.set_name}`\n"
|
34 |
+
file_id += f"**Sticker Emoji**: `{rep.sticker.emoji}`\n"
|
35 |
+
if rep.sticker.is_animated:
|
36 |
+
file_id += f"**Animated Sticker**: `{rep.sticker.is_animated}`\n"
|
37 |
+
elif rep.sticker.is_video:
|
38 |
+
file_id += f"**Video Sticker**: `{rep.sticker.is_video}`\n"
|
39 |
+
elif rep.sticker.is_premium:
|
40 |
+
file_id += f"**Premium Sticker**: `{rep.sticker.is_premium}`\n"
|
41 |
+
else:
|
42 |
+
file_id += "**Animated Sticker**: `False`\n"
|
43 |
+
file_id += "**Video Sticker**: `False`\n"
|
44 |
+
file_id += "**Premium Sticker**: `False`\n"
|
45 |
+
else:
|
46 |
+
file_id += "**Sticker Set**: __None__\n"
|
47 |
+
file_id += "**Sticker Emoji**: __None__"
|
48 |
+
elif rep.video:
|
49 |
+
file_id = f"**File ID**: `{rep.video.file_id}`\n"
|
50 |
+
file_id += "**File Type**: `video`"
|
51 |
+
elif rep.animation:
|
52 |
+
file_id = f"**File ID**: `{rep.animation.file_id}`\n"
|
53 |
+
file_id += "**File Type**: `GIF`"
|
54 |
+
elif rep.voice:
|
55 |
+
file_id = f"**File ID**: `{rep.voice.file_id}`\n"
|
56 |
+
file_id += "**File Type**: `Voice Note`"
|
57 |
+
elif rep.video_note:
|
58 |
+
file_id = f"**File ID**: `{rep.animation.file_id}`\n"
|
59 |
+
file_id += "**File Type**: `Video Note`"
|
60 |
+
elif rep.location:
|
61 |
+
file_id = "**Location**:\n"
|
62 |
+
file_id += f"**longitude**: `{rep.location.longitude}`\n"
|
63 |
+
file_id += f"**latitude**: `{rep.location.latitude}`"
|
64 |
+
elif rep.venue:
|
65 |
+
file_id = "**Location**:\n"
|
66 |
+
file_id += f"**longitude**: `{rep.venue.location.longitude}`\n"
|
67 |
+
file_id += f"**latitude**: `{rep.venue.location.latitude}`\n\n"
|
68 |
+
file_id += "**Address**:\n"
|
69 |
+
file_id += f"**title**: `{rep.venue.title}`\n"
|
70 |
+
file_id += f"**detailed**: `{rep.venue.address}`\n\n"
|
71 |
+
elif rep.from_user:
|
72 |
+
user_id = rep.from_user.id
|
73 |
+
if user_id:
|
74 |
+
if rep.forward_from:
|
75 |
+
user_detail = (
|
76 |
+
f"**Forwarded User ID**: `{message.reply_to_message.forward_from.id}`\n"
|
77 |
+
)
|
78 |
+
else:
|
79 |
+
user_detail = f"**User ID**: `{message.reply_to_message.from_user.id}`\n"
|
80 |
+
user_detail += f"**Message ID**: `{message.reply_to_message.id}`"
|
81 |
+
await message.edit_text(user_detail)
|
82 |
+
elif file_id:
|
83 |
+
if rep.forward_from:
|
84 |
+
user_detail = (
|
85 |
+
f"**Forwarded User ID**: `{message.reply_to_message.forward_from.id}`\n"
|
86 |
+
)
|
87 |
+
else:
|
88 |
+
user_detail = f"**User ID**: `{message.reply_to_message.from_user.id}`\n"
|
89 |
+
user_detail += f"**Message ID**: `{message.reply_to_message.id}`\n\n"
|
90 |
+
user_detail += file_id
|
91 |
+
await message.edit_text(user_detail)
|
92 |
+
else:
|
93 |
+
await message.edit_text(f"**Chat ID**: `{message.chat.id}`")
|
Akeno/plugins/translate.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import asyncio
|
3 |
+
import random
|
4 |
+
import time
|
5 |
+
from pyrogram import Client, filters
|
6 |
+
from pyrogram.types import Message
|
7 |
+
from gpytranslate import SyncTranslator
|
8 |
+
from Akeno.utils.handler import *
|
9 |
+
from config import *
|
10 |
+
|
11 |
+
trans = SyncTranslator()
|
12 |
+
|
13 |
+
@Akeno(
|
14 |
+
~filters.scheduled
|
15 |
+
& filters.command(["tr"], CMD_HANDLER)
|
16 |
+
& filters.me
|
17 |
+
& ~filters.forwarded
|
18 |
+
)
|
19 |
+
async def translate(update: Client, message: Message):
|
20 |
+
global to_translate
|
21 |
+
bot = update
|
22 |
+
reply_msg = message.reply_to_message
|
23 |
+
if not reply_msg:
|
24 |
+
await message.reply_text("Reply to a message to translate it!")
|
25 |
+
return
|
26 |
+
if reply_msg.caption:
|
27 |
+
to_translate = reply_msg.caption
|
28 |
+
elif reply_msg.text:
|
29 |
+
to_translate = reply_msg.text
|
30 |
+
try:
|
31 |
+
args = message.text.split()[1].lower()
|
32 |
+
if "//" in args:
|
33 |
+
source = args.split("//")[0]
|
34 |
+
dest = args.split("//")[1]
|
35 |
+
else:
|
36 |
+
source = trans.detect(to_translate)
|
37 |
+
dest = args
|
38 |
+
except IndexError:
|
39 |
+
source = trans.detect(to_translate)
|
40 |
+
dest = "en"
|
41 |
+
translation = trans(to_translate, sourcelang=source, targetlang=dest)
|
42 |
+
reply = ""
|
43 |
+
reply += f"<b>Translated from {source} to {dest}</b>:\n"
|
44 |
+
reply += f"<code>{translation.text}</code>\n"
|
45 |
+
try:
|
46 |
+
await message.reply_text(reply)
|
47 |
+
except Exception as e:
|
48 |
+
await message.reply_text(f"Error : {e}")
|