-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathutils.py
More file actions
133 lines (118 loc) · 4.21 KB
/
utils.py
File metadata and controls
133 lines (118 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
from methods.inline_keyboard import InlineKeyboardMarkup
from database.settings import get_user_settings
from config import BOT, FORCE_SUB
class BOARD:
def START_KEYBOARD():
return InlineKeyboardMarkup.button_grid(
[
[
{
"text": "⚙️ Change Hosting",
"callback_data": "setting",
"style": "primary",
}
],
[
{
"text": "📢 Join Channel",
"url": "https://t.me/XylonBots",
}
],
[
{
"text": "↗️ Source Code",
"url": "https://github.com/XylonBots/ImgUploadBot",
"style": "primary",
}
],
]
).to_dict()
def SETTING_KEYBOARD(chat_id):
user_settings = get_user_settings(chat_id)
uploader = None
if (
"uploader" in user_settings
and user_settings["uploader"] in BOT.UPLOADERS_AVAILABLE
):
uploader = user_settings["uploader"]
if uploader == None:
uploader = "imgbb"
return InlineKeyboardMarkup.button_grid(
[
[
{
"text": f"Imgbb" + (" ✅" if uploader == "imgbb" else ""),
"callback_data": "imgbb",
"style": "success" if uploader == "imgbb" else "primary",
}
],
[
{
"text": "FreeImage"
+ (" ✅" if uploader == "freeimage" else ""),
"callback_data": "freeimage",
"style": "success" if uploader == "freeimage" else "primary",
}
],
[
{
"text": "PostImages"
+ (" ✅" if uploader == "postimages" else ""),
"callback_data": "postimages",
"style": "success" if uploader == "postimages" else "primary",
}
],
[
{
"text": "🔙 Back",
"callback_data": "back",
"style": "danger",
}
],
]
).to_dict()
def BACK_TO_MENU_KEYBOARD():
return InlineKeyboardMarkup.button_grid(
[
[
{
"text": "🔙 Back To menu",
"callback_data": "back_to_menu",
}
],
]
).to_dict()
def FORCE_SUB_KEYBOARD():
return InlineKeyboardMarkup.button_grid(
[
[
{
"text": "⭐ Join Channel",
"url": "https://t.me/"
+ FORCE_SUB.CHANNEL_USERNAME.replace("@", ""),
"style": "success",
}
],
]
).to_dict()
class TEXT:
START_MSG = """
<b>🚀 Welcome to the Image Uploader Bot!</b>
I'm here to help you upload images and get a shareable link in seconds.
<b>How it works:</b>
• Send me any <b>image</b> as a photo or document.
• I'll upload it using your chosen service.
• You'll receive a direct URL to share or download.
<b>⚙️ Change Hosting:</b> Tap the button below to select your preferred hosting to upload your image.
Let's get started — send me an image now!
"""
HOSTINGS_MSG = """
<b>⚙️ Current uploader:</b> <code>{0}</code>
<i>Choose your preferred uploader from the buttons below.</i>
"""
FORCE_SUB_MSG = """
<b>🔒 Access Restricted</b>
To use this bot, you need to join our official channel first.
<b>📢 Channel:</b> {0}
<i>Once you've joined, please send your request again.</i>
"""