redzedbot 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RedZed , 4REAL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,246 @@
1
+ Metadata-Version: 2.4
2
+ Name: redzedbot
3
+ Version: 1.0.0
4
+ Summary: FreeFire Async TCP Bot ! , Fast , Safe , Legal , Ethical , By RedZedKing
5
+ License: MIT
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE.txt
9
+ Requires-Dist: aiohttp
10
+ Requires-Dist: pycryptodome
11
+ Requires-Dist: protobuf
12
+ Requires-Dist: google-play-scraper
13
+ Requires-Dist: requests
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest; extra == "dev"
16
+ Requires-Dist: pytest-asyncio; extra == "dev"
17
+ Dynamic: license-file
18
+
19
+ # redzedbot
20
+
21
+ An async Python library for Free Fire bot sessions — clean API, auto-reconnect, and event-driven message handling.
22
+
23
+ ---
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install redzedbot
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Quick start
34
+
35
+ ```python
36
+ import asyncio
37
+ from redzedbot import guest
38
+
39
+ async def main():
40
+ bot = await guest.login('UID', 'PASSWORD') #login
41
+ if bot: #if logged in successfully
42
+ print(bot._token) #print JWT
43
+ @bot.online() #bot online handler
44
+ def on_ready(bot):
45
+ if bot.is_connected: #if bot is connected to online tcp
46
+ print(bot.nickname) #show bot name
47
+ print(f'''
48
+ {'-'*20}
49
+ Bot Online ! .
50
+ Bot Name : {bot.nickname}
51
+ Region : {bot.region}
52
+ Uid : {bot.account_uid}
53
+ {'-'*20}
54
+ ''') #just to explain more .
55
+
56
+
57
+ @bot.message_handler(command='hello') #two commands handlers .
58
+ async def hello(msg):
59
+ user_id = msg.user_id
60
+ await bot.send_dm('Hello There ! ', user_id)
61
+
62
+
63
+ @bot.message_handler(command='king')
64
+ async def reply(msg):
65
+ uid = msg.user_id
66
+ name = msg.nickname
67
+ if uid == 6728454010: #check if the uid equals to a specific uid to give a diffrent reply / command .
68
+ await bot.send_dm(f'Welcome ! RedZed :/ , {name}',uid)
69
+ else:
70
+ await bot.send_dm('Lol , not redzed',uid)
71
+
72
+ @bot.message_handler(command='add') #one command handler
73
+ async def world(msg):
74
+ user_id = msg.user_id
75
+ txt = msg.text
76
+ parts = txt.strip().split() #split text parts according to spaces .
77
+ if len(parts) < 2: #check if the parts are less than 2 args
78
+ await bot.send_dm('Please Specify A Uid . ', user_id) #if less than 2 args
79
+ else:
80
+ uid = parts[1]
81
+ msg = await bot.add_friend(uid) #proceed to add the uid
82
+ await bot.send_dm(msg , user_id)
83
+
84
+
85
+
86
+
87
+
88
+ await bot.online_loop() #loop online
89
+
90
+
91
+ if __name__ == "__main__":
92
+ asyncio.run(main())
93
+ ```
94
+
95
+ ---
96
+
97
+ ### `Bot` — properties
98
+
99
+ | Property | Type | Description |
100
+ |---|---|---|
101
+ | `bot.nickname` | `str` | In-game account name |
102
+ | `bot.uid` | `int` | account UID |
103
+ | `bot.region` | `str` | Server region (e.g. `"ME"`, `"SEA"`) |
104
+ | `bot.clan_id` | `int \| None` | Clan ID, or `None` if not in a clan |
105
+ | `bot.is_connected` | `bool` | `True` after the TCP sockets are live |
106
+
107
+ ---
108
+
109
+ ### `Bot` — messaging
110
+
111
+ ```python
112
+ await bot.send_squad("hello team") # team / squad chat
113
+ await bot.send_guild("hello clan") # guild / clan chat (raises if no clan)
114
+ await bot.send_dm(target_uid, "hey there") # whisper / DM
115
+ ```
116
+
117
+ All three raise `RuntimeError` if the bot is not yet connected.
118
+
119
+ ---
120
+
121
+ ### `Bot` — decorators
122
+
123
+ #### `@bot.online()`
124
+
125
+ Fires **once**, right after both TCP sockets connect (or reconnect). Receives the `Bot` instance. Works with both `async def` and plain `def`.
126
+
127
+ ```python
128
+ @bot.online()
129
+ def on_ready(bot):
130
+ print(bot.nickname)
131
+
132
+ # ── or ──
133
+
134
+ @bot.online()
135
+ async def on_ready(bot):
136
+ await bot.send_dm("I'm alive!",123456789)
137
+ ```
138
+
139
+ ---
140
+
141
+ #### `@bot.on_message`
142
+
143
+ Fires for **every** incoming chat / whisper packet. Receives `(bot, msg)`.
144
+
145
+ ```python
146
+ @bot.on_message
147
+ async def handler(bot, msg):
148
+ print(msg["sender"], ":", msg["text"])
149
+ ```
150
+
151
+ `msg` dict keys:
152
+
153
+ | Key | Description |
154
+ |---|---|
155
+ | `uid` | Sender's numeric UID |
156
+ | `chat_id` | Chat-room / target UID |
157
+ | `type` | Chat type int (squad / guild / DM) |
158
+ | `text` | Message body string |
159
+ | `sender` | Sender's nickname |
160
+ | `avatar` | Sender's profile-pic URL |
161
+ ---
162
+
163
+ #### `@bot.on_error`
164
+
165
+ Fires whenever a TCP connection error occurs **before** the reconnect sleep. Receives `(bot, exception)`.
166
+
167
+ ```python
168
+ @bot.on_error
169
+ def on_err(bot, err):
170
+ print("Connection error:", err)
171
+ ```
172
+
173
+ ---
174
+
175
+ #### `@bot.on_disconnect`
176
+
177
+ Fires once after both sockets have been fully closed (e.g. after you call `await bot.disconnect()`).
178
+
179
+ ```python
180
+ @bot.on_disconnect
181
+ def on_dc(bot):
182
+ print("Disconnected, bye!")
183
+ ```
184
+
185
+ ---
186
+
187
+ ### `Bot` — lifecycle
188
+
189
+ ```python
190
+ await bot.online_loop(reconnect_delay=3.0) # blocking – runs forever, auto-reconnects
191
+ ```
192
+
193
+ `online_loop` manages both the **Online** and **Chat** TCP sockets concurrently. If either socket drops, both are torn down and re-established after `reconnect_delay`
194
+
195
+ ---
196
+
197
+ ## Full example — echo bot
198
+
199
+ ```python
200
+ import asyncio
201
+ from redzedbot import guest
202
+
203
+ async def main():
204
+ bot = await guest.login("UID", "PASSWORD")
205
+ if not bot:
206
+ print("Login failed"); return
207
+
208
+ @bot.online()
209
+ def ready(bot):
210
+ print(f"[{bot.region}] {bot.nickname} is online")
211
+
212
+ @bot.on_message
213
+ async def echo(bot, msg):
214
+ text = msg.text
215
+ if text.startswith("!say "):
216
+ await bot.send_dm(text[5:],msg["uid"]) #first one gets the text after 5 letters according to '!say ' to get what the user has typed / second one to get uid
217
+ #or instead of using msg["uid"] you can use : uid = msg.user_id
218
+
219
+
220
+ @bot.on_error
221
+ def err(bot, e):
222
+ print("err:", e)
223
+
224
+ #currently not working , i didn't test it yet
225
+
226
+ @bot.on_disconnect
227
+ def dc(bot):
228
+ print("disconnected")
229
+
230
+
231
+ await bot.online_loop()
232
+
233
+ asyncio.run(main())
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Notes
239
+
240
+ * The library is **async-only**. Everything must run inside `asyncio.run()`.
241
+ * SSL certificate verification is deliberately disabled for the Garena
242
+ endpoints (mirrors the original client behaviour).
243
+ * `online_loop()` auto-reconnects on socket errors. Token expiry (≈ 7 h)
244
+ requires a fresh `guest.login()` call.
245
+ * All decorators accept both `async def` and plain `def` — the library
246
+ detects and handles both transparently.
@@ -0,0 +1,228 @@
1
+ # redzedbot
2
+
3
+ An async Python library for Free Fire bot sessions — clean API, auto-reconnect, and event-driven message handling.
4
+
5
+ ---
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install redzedbot
11
+ ```
12
+
13
+ ---
14
+
15
+ ## Quick start
16
+
17
+ ```python
18
+ import asyncio
19
+ from redzedbot import guest
20
+
21
+ async def main():
22
+ bot = await guest.login('UID', 'PASSWORD') #login
23
+ if bot: #if logged in successfully
24
+ print(bot._token) #print JWT
25
+ @bot.online() #bot online handler
26
+ def on_ready(bot):
27
+ if bot.is_connected: #if bot is connected to online tcp
28
+ print(bot.nickname) #show bot name
29
+ print(f'''
30
+ {'-'*20}
31
+ Bot Online ! .
32
+ Bot Name : {bot.nickname}
33
+ Region : {bot.region}
34
+ Uid : {bot.account_uid}
35
+ {'-'*20}
36
+ ''') #just to explain more .
37
+
38
+
39
+ @bot.message_handler(command='hello') #two commands handlers .
40
+ async def hello(msg):
41
+ user_id = msg.user_id
42
+ await bot.send_dm('Hello There ! ', user_id)
43
+
44
+
45
+ @bot.message_handler(command='king')
46
+ async def reply(msg):
47
+ uid = msg.user_id
48
+ name = msg.nickname
49
+ if uid == 6728454010: #check if the uid equals to a specific uid to give a diffrent reply / command .
50
+ await bot.send_dm(f'Welcome ! RedZed :/ , {name}',uid)
51
+ else:
52
+ await bot.send_dm('Lol , not redzed',uid)
53
+
54
+ @bot.message_handler(command='add') #one command handler
55
+ async def world(msg):
56
+ user_id = msg.user_id
57
+ txt = msg.text
58
+ parts = txt.strip().split() #split text parts according to spaces .
59
+ if len(parts) < 2: #check if the parts are less than 2 args
60
+ await bot.send_dm('Please Specify A Uid . ', user_id) #if less than 2 args
61
+ else:
62
+ uid = parts[1]
63
+ msg = await bot.add_friend(uid) #proceed to add the uid
64
+ await bot.send_dm(msg , user_id)
65
+
66
+
67
+
68
+
69
+
70
+ await bot.online_loop() #loop online
71
+
72
+
73
+ if __name__ == "__main__":
74
+ asyncio.run(main())
75
+ ```
76
+
77
+ ---
78
+
79
+ ### `Bot` — properties
80
+
81
+ | Property | Type | Description |
82
+ |---|---|---|
83
+ | `bot.nickname` | `str` | In-game account name |
84
+ | `bot.uid` | `int` | account UID |
85
+ | `bot.region` | `str` | Server region (e.g. `"ME"`, `"SEA"`) |
86
+ | `bot.clan_id` | `int \| None` | Clan ID, or `None` if not in a clan |
87
+ | `bot.is_connected` | `bool` | `True` after the TCP sockets are live |
88
+
89
+ ---
90
+
91
+ ### `Bot` — messaging
92
+
93
+ ```python
94
+ await bot.send_squad("hello team") # team / squad chat
95
+ await bot.send_guild("hello clan") # guild / clan chat (raises if no clan)
96
+ await bot.send_dm(target_uid, "hey there") # whisper / DM
97
+ ```
98
+
99
+ All three raise `RuntimeError` if the bot is not yet connected.
100
+
101
+ ---
102
+
103
+ ### `Bot` — decorators
104
+
105
+ #### `@bot.online()`
106
+
107
+ Fires **once**, right after both TCP sockets connect (or reconnect). Receives the `Bot` instance. Works with both `async def` and plain `def`.
108
+
109
+ ```python
110
+ @bot.online()
111
+ def on_ready(bot):
112
+ print(bot.nickname)
113
+
114
+ # ── or ──
115
+
116
+ @bot.online()
117
+ async def on_ready(bot):
118
+ await bot.send_dm("I'm alive!",123456789)
119
+ ```
120
+
121
+ ---
122
+
123
+ #### `@bot.on_message`
124
+
125
+ Fires for **every** incoming chat / whisper packet. Receives `(bot, msg)`.
126
+
127
+ ```python
128
+ @bot.on_message
129
+ async def handler(bot, msg):
130
+ print(msg["sender"], ":", msg["text"])
131
+ ```
132
+
133
+ `msg` dict keys:
134
+
135
+ | Key | Description |
136
+ |---|---|
137
+ | `uid` | Sender's numeric UID |
138
+ | `chat_id` | Chat-room / target UID |
139
+ | `type` | Chat type int (squad / guild / DM) |
140
+ | `text` | Message body string |
141
+ | `sender` | Sender's nickname |
142
+ | `avatar` | Sender's profile-pic URL |
143
+ ---
144
+
145
+ #### `@bot.on_error`
146
+
147
+ Fires whenever a TCP connection error occurs **before** the reconnect sleep. Receives `(bot, exception)`.
148
+
149
+ ```python
150
+ @bot.on_error
151
+ def on_err(bot, err):
152
+ print("Connection error:", err)
153
+ ```
154
+
155
+ ---
156
+
157
+ #### `@bot.on_disconnect`
158
+
159
+ Fires once after both sockets have been fully closed (e.g. after you call `await bot.disconnect()`).
160
+
161
+ ```python
162
+ @bot.on_disconnect
163
+ def on_dc(bot):
164
+ print("Disconnected, bye!")
165
+ ```
166
+
167
+ ---
168
+
169
+ ### `Bot` — lifecycle
170
+
171
+ ```python
172
+ await bot.online_loop(reconnect_delay=3.0) # blocking – runs forever, auto-reconnects
173
+ ```
174
+
175
+ `online_loop` manages both the **Online** and **Chat** TCP sockets concurrently. If either socket drops, both are torn down and re-established after `reconnect_delay`
176
+
177
+ ---
178
+
179
+ ## Full example — echo bot
180
+
181
+ ```python
182
+ import asyncio
183
+ from redzedbot import guest
184
+
185
+ async def main():
186
+ bot = await guest.login("UID", "PASSWORD")
187
+ if not bot:
188
+ print("Login failed"); return
189
+
190
+ @bot.online()
191
+ def ready(bot):
192
+ print(f"[{bot.region}] {bot.nickname} is online")
193
+
194
+ @bot.on_message
195
+ async def echo(bot, msg):
196
+ text = msg.text
197
+ if text.startswith("!say "):
198
+ await bot.send_dm(text[5:],msg["uid"]) #first one gets the text after 5 letters according to '!say ' to get what the user has typed / second one to get uid
199
+ #or instead of using msg["uid"] you can use : uid = msg.user_id
200
+
201
+
202
+ @bot.on_error
203
+ def err(bot, e):
204
+ print("err:", e)
205
+
206
+ #currently not working , i didn't test it yet
207
+
208
+ @bot.on_disconnect
209
+ def dc(bot):
210
+ print("disconnected")
211
+
212
+
213
+ await bot.online_loop()
214
+
215
+ asyncio.run(main())
216
+ ```
217
+
218
+ ---
219
+
220
+ ## Notes
221
+
222
+ * The library is **async-only**. Everything must run inside `asyncio.run()`.
223
+ * SSL certificate verification is deliberately disabled for the Garena
224
+ endpoints (mirrors the original client behaviour).
225
+ * `online_loop()` auto-reconnects on socket errors. Token expiry (≈ 7 h)
226
+ requires a fresh `guest.login()` call.
227
+ * All decorators accept both `async def` and plain `def` — the library
228
+ detects and handles both transparently.
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "redzedbot"
7
+ version = "1.0.0"
8
+ description = "FreeFire Async TCP Bot ! , Fast , Safe , Legal , Ethical , By RedZedKing"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {text = "MIT"}
12
+
13
+ dependencies = [
14
+ "aiohttp",
15
+ "pycryptodome",
16
+ "protobuf",
17
+ "google-play-scraper",
18
+ "requests",
19
+ ]
20
+
21
+ [project.optional-dependencies]
22
+ dev = ["pytest", "pytest-asyncio"]
23
+
24
+ [tool.setuptools.packages.find]
25
+ include = ["redzedbot*"]
@@ -0,0 +1,9 @@
1
+ """
2
+ redzedbot - Async Free Fire Bot Library
3
+ """
4
+
5
+ from .client import redzedbot
6
+ from .guest import login
7
+
8
+ __version__ = "5.0.0"
9
+ __all__ = ["redzedbot", "login"]