roboat 1.1.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.
- roboat-1.1.0/LICENSE +21 -0
- roboat-1.1.0/MANIFEST.in +4 -0
- roboat-1.1.0/PKG-INFO +550 -0
- roboat-1.1.0/README.md +499 -0
- roboat-1.1.0/roboat/__init__.py +54 -0
- roboat-1.1.0/roboat/__main__.py +7 -0
- roboat-1.1.0/roboat/analytics.py +343 -0
- roboat-1.1.0/roboat/async_client.py +447 -0
- roboat-1.1.0/roboat/avatar.py +45 -0
- roboat-1.1.0/roboat/badges.py +50 -0
- roboat-1.1.0/roboat/catalog.py +81 -0
- roboat-1.1.0/roboat/client.py +299 -0
- roboat-1.1.0/roboat/database.py +258 -0
- roboat-1.1.0/roboat/develop.py +517 -0
- roboat-1.1.0/roboat/economy.py +64 -0
- roboat-1.1.0/roboat/events.py +259 -0
- roboat-1.1.0/roboat/exceptions.py +64 -0
- roboat-1.1.0/roboat/friends.py +80 -0
- roboat-1.1.0/roboat/games.py +220 -0
- roboat-1.1.0/roboat/groups.py +356 -0
- roboat-1.1.0/roboat/inventory.py +189 -0
- roboat-1.1.0/roboat/marketplace.py +344 -0
- roboat-1.1.0/roboat/messages.py +194 -0
- roboat-1.1.0/roboat/models.py +534 -0
- roboat-1.1.0/roboat/moderation.py +233 -0
- roboat-1.1.0/roboat/notifications.py +150 -0
- roboat-1.1.0/roboat/oauth.py +152 -0
- roboat-1.1.0/roboat/opencloud.py +456 -0
- roboat-1.1.0/roboat/presence.py +49 -0
- roboat-1.1.0/roboat/publish.py +222 -0
- roboat-1.1.0/roboat/session.py +616 -0
- roboat-1.1.0/roboat/social.py +240 -0
- roboat-1.1.0/roboat/thumbnails.py +94 -0
- roboat-1.1.0/roboat/trades.py +213 -0
- roboat-1.1.0/roboat/users.py +76 -0
- roboat-1.1.0/roboat/utils/__init__.py +5 -0
- roboat-1.1.0/roboat/utils/cache.py +123 -0
- roboat-1.1.0/roboat/utils/paginator.py +70 -0
- roboat-1.1.0/roboat/utils/ratelimit.py +101 -0
- roboat-1.1.0/roboat.egg-info/PKG-INFO +550 -0
- roboat-1.1.0/roboat.egg-info/SOURCES.txt +46 -0
- roboat-1.1.0/roboat.egg-info/dependency_links.txt +1 -0
- roboat-1.1.0/roboat.egg-info/entry_points.txt +2 -0
- roboat-1.1.0/roboat.egg-info/requires.txt +11 -0
- roboat-1.1.0/roboat.egg-info/top_level.txt +1 -0
- roboat-1.1.0/setup.cfg +4 -0
- roboat-1.1.0/setup.py +59 -0
- roboat-1.1.0/tests/test_models.py +319 -0
roboat-1.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 robloxapi contributors
|
|
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.
|
roboat-1.1.0/MANIFEST.in
ADDED
roboat-1.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: roboat
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: The best Python wrapper for the Roblox API — OAuth, async, typed models, datastores, events, marketplace tools
|
|
5
|
+
Home-page: https://github.com/Addi9000/roboat
|
|
6
|
+
Author: roboat contributors
|
|
7
|
+
Author-email: bwesttwink@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/Addi9000/roboat/issues
|
|
10
|
+
Project-URL: Documentation, https://www.roboat.pro/docs
|
|
11
|
+
Project-URL: Source, https://github.com/Addi9000/roboat
|
|
12
|
+
Keywords: roblox,api,wrapper,roblox-api,roboat,games,catalog,trading,opencloud,datastore,automation,bot,economy
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Topic :: Games/Entertainment
|
|
25
|
+
Classifier: Environment :: Console
|
|
26
|
+
Requires-Python: >=3.8
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: requests>=2.28.0
|
|
30
|
+
Provides-Extra: async
|
|
31
|
+
Requires-Dist: aiohttp>=3.8.0; extra == "async"
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
34
|
+
Provides-Extra: all
|
|
35
|
+
Requires-Dist: aiohttp>=3.8.0; extra == "all"
|
|
36
|
+
Requires-Dist: pytest>=7.0; extra == "all"
|
|
37
|
+
Dynamic: author
|
|
38
|
+
Dynamic: author-email
|
|
39
|
+
Dynamic: classifier
|
|
40
|
+
Dynamic: description
|
|
41
|
+
Dynamic: description-content-type
|
|
42
|
+
Dynamic: home-page
|
|
43
|
+
Dynamic: keywords
|
|
44
|
+
Dynamic: license
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
Dynamic: project-url
|
|
47
|
+
Dynamic: provides-extra
|
|
48
|
+
Dynamic: requires-dist
|
|
49
|
+
Dynamic: requires-python
|
|
50
|
+
Dynamic: summary
|
|
51
|
+
|
|
52
|
+
<div align="center">
|
|
53
|
+
|
|
54
|
+
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:6EE7F7,100:A78BFA&height=200§ion=header&text=roboat&fontSize=80&fontColor=ffffff&animation=fadeIn&fontAlignY=38&desc=The%20best%20Python%20wrapper%20for%20the%20Roblox%20API&descAlignY=60&descAlign=50" width="100%"/>
|
|
55
|
+
|
|
56
|
+
<br/>
|
|
57
|
+
|
|
58
|
+
[](https://python.org)
|
|
59
|
+
[](LICENSE)
|
|
60
|
+
[](https://github.com/valeoncehadadream/roboat)
|
|
61
|
+
[](https://github.com/valeoncehadadream/roboat)
|
|
62
|
+
|
|
63
|
+
<br/>
|
|
64
|
+
|
|
65
|
+
<img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=22&pause=1000&color=6EE7F7¢er=true&vCenter=true&width=600&lines=OAuth+2.0+Authentication;Typed+Models+for+Every+Response;Async+%2B+Sync+Clients;Built-in+SQLite+Database;Open+Cloud+%2B+DataStores;Real-time+Event+System;Marketplace+%26+Economy+Tools;Interactive+Terminal+REPL" alt="Typing SVG" />
|
|
66
|
+
|
|
67
|
+
<br/><br/>
|
|
68
|
+
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Install
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install .
|
|
77
|
+
pip install ".[async]" # with aiohttp for async support
|
|
78
|
+
pip install ".[all]" # everything including tests
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Quick Start
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from roboat import RoboatClient
|
|
87
|
+
|
|
88
|
+
client = RoboatClient()
|
|
89
|
+
|
|
90
|
+
user = client.users.get_user(156)
|
|
91
|
+
print(user) # Builderman (@builderman) [ID: 156]
|
|
92
|
+
|
|
93
|
+
game = client.games.get_game(2753915549)
|
|
94
|
+
print(f"{game.name} — {game.visits:,} visits")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Interactive Terminal
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
roboat
|
|
103
|
+
# or
|
|
104
|
+
python -m roboat
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
____ _ _ _ ____ ___
|
|
109
|
+
| _ \ ___ | |__ | | _____ __/ \ | _ \_ _|
|
|
110
|
+
| |_) / _ \| '_ \| |/ _ \ \/ / _ \ | |_) | |
|
|
111
|
+
| _ < (_) | |_) | | (_) > < ___ \| __/| |
|
|
112
|
+
|_| \_\___/|_.__/|_|\___/_/\_/_/ \_|_| |___|
|
|
113
|
+
|
|
114
|
+
roboat v2.1.0 — type 'help' to begin
|
|
115
|
+
|
|
116
|
+
» start 156
|
|
117
|
+
» auth
|
|
118
|
+
» game 2753915549
|
|
119
|
+
» inventory 156
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Every command requires `start <userid>` first. The terminal will remind you if you forget.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## OAuth Authentication
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from roboat import OAuthManager, RoboatClient
|
|
130
|
+
|
|
131
|
+
manager = OAuthManager(
|
|
132
|
+
on_success=lambda token: print("Authenticated!"),
|
|
133
|
+
on_failure=lambda err: print(f"Failed: {err}"),
|
|
134
|
+
timeout=120,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
token = manager.authenticate() # opens browser, waits 120s
|
|
138
|
+
|
|
139
|
+
if token:
|
|
140
|
+
client = RoboatClient(oauth_token=token)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
In the terminal, type `auth`. Your browser opens automatically and you have **120 seconds** to complete login with a live countdown shown.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## All Modules
|
|
148
|
+
|
|
149
|
+
| Module | What It Does |
|
|
150
|
+
|:---|:---|
|
|
151
|
+
| `client.py` | Main sync client with caching and rate limiting |
|
|
152
|
+
| `async_client.py` | Full async mirror using aiohttp |
|
|
153
|
+
| `oauth.py` | OAuth 2.0 with 120s timeout |
|
|
154
|
+
| `session.py` | Interactive terminal REPL |
|
|
155
|
+
| `database.py` | Local SQLite persistence |
|
|
156
|
+
| `models.py` | 20+ typed dataclass response models |
|
|
157
|
+
| `exceptions.py` | Typed exceptions per HTTP status |
|
|
158
|
+
| `events.py` | Background polling event system |
|
|
159
|
+
| `analytics.py` | Parallel report aggregation |
|
|
160
|
+
| `marketplace.py` | Limited items, RAP tracking, profit estimator |
|
|
161
|
+
| `social.py` | Friend graph, mutual analysis, presence tools |
|
|
162
|
+
| `notifications.py` | Experience push notifications |
|
|
163
|
+
| `publish.py` | Asset upload (images, audio, models) |
|
|
164
|
+
| `moderation.py` | Reports, blocks, chat filter |
|
|
165
|
+
| `opencloud.py` | Open Cloud API key client |
|
|
166
|
+
| `develop.py` | Universe, DataStores, bans, Team Create |
|
|
167
|
+
| `users.py` | User lookup, search, bulk fetch |
|
|
168
|
+
| `games.py` | Games, visits, servers, votes |
|
|
169
|
+
| `catalog.py` | Avatar shop search and item details |
|
|
170
|
+
| `groups.py` | Full group management and payouts |
|
|
171
|
+
| `friends.py` | Friends, followers, followings |
|
|
172
|
+
| `thumbnails.py` | All thumbnail types as {id: url} |
|
|
173
|
+
| `badges.py` | Badges and award dates |
|
|
174
|
+
| `economy.py` | Transactions and resale data |
|
|
175
|
+
| `presence.py` | Online and in-game status |
|
|
176
|
+
| `avatar.py` | Avatar assets and outfits |
|
|
177
|
+
| `trades.py` | Trade list, send, accept, decline |
|
|
178
|
+
| `messages.py` | Private messages and chat |
|
|
179
|
+
| `inventory.py` | Ownership, RAP, collectibles |
|
|
180
|
+
| `utils/cache.py` | Thread-safe TTL LRU cache |
|
|
181
|
+
| `utils/ratelimit.py` | Token bucket and @retry decorator |
|
|
182
|
+
| `utils/paginator.py` | Lazy auto-pagination iterator |
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Client Setup
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from roboat import RoboatClient, ClientBuilder
|
|
190
|
+
|
|
191
|
+
# Simple
|
|
192
|
+
client = RoboatClient()
|
|
193
|
+
|
|
194
|
+
# Builder — full control
|
|
195
|
+
client = (
|
|
196
|
+
ClientBuilder()
|
|
197
|
+
.set_oauth_token("YOUR_TOKEN")
|
|
198
|
+
.set_timeout(15)
|
|
199
|
+
.set_cache_ttl(60)
|
|
200
|
+
.set_cache_size(512)
|
|
201
|
+
.set_rate_limit(10)
|
|
202
|
+
.set_proxy("http://proxy:8080")
|
|
203
|
+
.build()
|
|
204
|
+
)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Async Client
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
import asyncio
|
|
211
|
+
from roboat import AsyncRoboatClient
|
|
212
|
+
|
|
213
|
+
async def main():
|
|
214
|
+
async with AsyncRoboatClient() as client:
|
|
215
|
+
game, votes, icon = await asyncio.gather(
|
|
216
|
+
client.games.get_game(2753915549),
|
|
217
|
+
client.games.get_votes([2753915549]),
|
|
218
|
+
client.thumbnails.get_game_icons([2753915549]),
|
|
219
|
+
)
|
|
220
|
+
users = await client.users.get_users_by_ids(list(range(1, 501)))
|
|
221
|
+
|
|
222
|
+
asyncio.run(main())
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Users
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
user = client.users.get_user(156)
|
|
231
|
+
users = client.users.get_users_by_ids([1, 156, 261])
|
|
232
|
+
users = client.users.get_users_by_usernames(["Roblox", "builderman"])
|
|
233
|
+
page = client.users.search_users("builderman", limit=10)
|
|
234
|
+
page = client.users.get_username_history(156)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Games
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
game = client.games.get_game(2753915549)
|
|
241
|
+
game = client.games.get_game_from_place(6872265039)
|
|
242
|
+
visits = client.games.get_visits([2753915549, 286090429])
|
|
243
|
+
votes = client.games.get_votes([2753915549])
|
|
244
|
+
page = client.games.get_servers(6872265039, limit=10)
|
|
245
|
+
page = client.games.get_user_games(156)
|
|
246
|
+
page = client.games.get_group_games(2868472)
|
|
247
|
+
page = client.games.search_games("obby", limit=20)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Groups
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
group = client.groups.get_group(7)
|
|
254
|
+
roles = client.groups.get_roles(7)
|
|
255
|
+
members = client.groups.get_members(7, limit=100)
|
|
256
|
+
|
|
257
|
+
# Management (auth required)
|
|
258
|
+
client.groups.set_member_role(7, user_id=1234, role_id=role.id)
|
|
259
|
+
client.groups.kick_member(7, user_id=1234)
|
|
260
|
+
client.groups.post_shout(7, "Message here")
|
|
261
|
+
client.groups.post_to_wall(7, "Wall post")
|
|
262
|
+
client.groups.accept_all_join_requests(7)
|
|
263
|
+
client.groups.pay_out(7, user_id=1234, amount=500)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Catalog
|
|
267
|
+
|
|
268
|
+
```python
|
|
269
|
+
page = client.catalog.search(keyword="fedora", category="Accessories", sort_type="Sales")
|
|
270
|
+
item = client.catalog.get_asset(1028606)
|
|
271
|
+
item = client.catalog.get_bundle(192)
|
|
272
|
+
resale = client.catalog.get_resale_data(1028606)
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Marketplace Tools
|
|
278
|
+
|
|
279
|
+
```python
|
|
280
|
+
from roboat.marketplace import MarketplaceAPI
|
|
281
|
+
|
|
282
|
+
market = MarketplaceAPI(client)
|
|
283
|
+
|
|
284
|
+
data = market.get_limited_data(1365767)
|
|
285
|
+
print(data.recent_average_price, data.price_trend)
|
|
286
|
+
|
|
287
|
+
profit = market.estimate_resale_profit(1365767, purchase_price=12000)
|
|
288
|
+
deals = market.find_underpriced_limiteds([1365767, 1028606])
|
|
289
|
+
|
|
290
|
+
tracker = market.create_rap_tracker([1365767, 1028606])
|
|
291
|
+
tracker.snapshot()
|
|
292
|
+
tracker.snapshot()
|
|
293
|
+
print(tracker.summary())
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Social Graph
|
|
297
|
+
|
|
298
|
+
```python
|
|
299
|
+
from roboat.social import SocialGraph
|
|
300
|
+
|
|
301
|
+
sg = SocialGraph(client)
|
|
302
|
+
|
|
303
|
+
mutuals = sg.mutual_friends(156, 261)
|
|
304
|
+
is_following = sg.does_follow(156, 261)
|
|
305
|
+
snap = sg.presence_snapshot([156, 261, 1234])
|
|
306
|
+
online_ids = sg.who_is_online([156, 261, 1234])
|
|
307
|
+
nodes = sg.most_followed_in_group([156, 261, 1234])
|
|
308
|
+
suggestions = sg.follow_suggestions(156, limit=10)
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Notifications
|
|
312
|
+
|
|
313
|
+
```python
|
|
314
|
+
from roboat.notifications import NotificationsAPI
|
|
315
|
+
|
|
316
|
+
notif = NotificationsAPI(api_key="roblox-KEY-xxxx")
|
|
317
|
+
|
|
318
|
+
result = notif.send(
|
|
319
|
+
universe_id=123456789,
|
|
320
|
+
user_id=1234,
|
|
321
|
+
message_id="daily-reward",
|
|
322
|
+
attributes={"coins": "500"},
|
|
323
|
+
join_experience={"launchData": "reward"},
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
results = notif.send_bulk(123456789, [1234, 5678], "daily-reward")
|
|
327
|
+
quota = notif.get_quota(123456789)
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Asset Publishing
|
|
331
|
+
|
|
332
|
+
```python
|
|
333
|
+
from roboat.publish import PublishAPI
|
|
334
|
+
|
|
335
|
+
pub = PublishAPI(api_key="roblox-KEY-xxxx", creator_id=156, creator_type="User")
|
|
336
|
+
|
|
337
|
+
asset = pub.upload_image("thumbnail.png", name="Game Icon")
|
|
338
|
+
asset = pub.upload_audio("bgm.ogg", name="Background Music")
|
|
339
|
+
asset = pub.upload_model("char.fbx", name="Character Model")
|
|
340
|
+
asset = pub.upload_auto("file.png", name="Auto Detected")
|
|
341
|
+
|
|
342
|
+
final = pub.wait_for_asset(asset.operation_id, max_wait=30)
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## Moderation
|
|
346
|
+
|
|
347
|
+
```python
|
|
348
|
+
from roboat.moderation import ModerationAPI
|
|
349
|
+
|
|
350
|
+
mod = ModerationAPI(client)
|
|
351
|
+
|
|
352
|
+
standing = mod.get_account_standing(user_id=1234)
|
|
353
|
+
mod.report_user(1234, reason="Spam")
|
|
354
|
+
mod.report_asset(11111, reason="Inappropriate")
|
|
355
|
+
mod.block_user(1234)
|
|
356
|
+
result = mod.filter_text("Hello!", user_id=1234)
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Open Cloud — Developer Tools
|
|
362
|
+
|
|
363
|
+
```python
|
|
364
|
+
API_KEY = "roblox-KEY-xxxxx"
|
|
365
|
+
UNIVERSE = 123456789
|
|
366
|
+
|
|
367
|
+
# DataStores
|
|
368
|
+
client.develop.set_datastore_entry(UNIVERSE, "PlayerData", "player_1234", {"coins": 500}, API_KEY)
|
|
369
|
+
client.develop.get_datastore_entry(UNIVERSE, "PlayerData", "player_1234", API_KEY)
|
|
370
|
+
client.develop.increment_datastore_entry(UNIVERSE, "Stats", "deaths", 1, API_KEY)
|
|
371
|
+
client.develop.delete_datastore_entry(UNIVERSE, "Sessions", "key", API_KEY)
|
|
372
|
+
client.develop.list_datastore_keys(UNIVERSE, "PlayerData", API_KEY)
|
|
373
|
+
|
|
374
|
+
# Ordered DataStores (leaderboards)
|
|
375
|
+
client.develop.list_ordered_datastore(UNIVERSE, "Leaderboard", API_KEY, max_page_size=10)
|
|
376
|
+
client.develop.set_ordered_datastore_entry(UNIVERSE, "Leaderboard", "player_1234", 9500, API_KEY)
|
|
377
|
+
client.develop.increment_ordered_datastore(UNIVERSE, "Leaderboard", "player_1234", 100, API_KEY)
|
|
378
|
+
|
|
379
|
+
# MessagingService — broadcast to all live servers
|
|
380
|
+
client.develop.publish_message(UNIVERSE, "Announcements", "Event in 5 minutes!", API_KEY)
|
|
381
|
+
client.develop.announce(UNIVERSE, API_KEY, "Server restart soon!")
|
|
382
|
+
client.develop.broadcast_shutdown(UNIVERSE, API_KEY)
|
|
383
|
+
|
|
384
|
+
# Bans
|
|
385
|
+
client.develop.ban_user(UNIVERSE, 1234, API_KEY, duration_seconds=86400, display_reason="Banned.")
|
|
386
|
+
client.develop.ban_user(UNIVERSE, 5678, API_KEY, duration_seconds=None) # permanent
|
|
387
|
+
client.develop.unban_user(UNIVERSE, 1234, API_KEY)
|
|
388
|
+
client.develop.list_bans(UNIVERSE, API_KEY)
|
|
389
|
+
|
|
390
|
+
# Team Create
|
|
391
|
+
client.develop.update_team_create(UNIVERSE, is_enabled=True)
|
|
392
|
+
client.develop.add_team_create_member(UNIVERSE, user_id=1234)
|
|
393
|
+
client.develop.get_team_create_members(UNIVERSE)
|
|
394
|
+
|
|
395
|
+
# Game Stats
|
|
396
|
+
stats = client.develop.get_game_stats(UNIVERSE, stat_type="Visits", granularity="Daily")
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## Database Layer
|
|
402
|
+
|
|
403
|
+
```python
|
|
404
|
+
from roboat import SessionDatabase
|
|
405
|
+
|
|
406
|
+
db = SessionDatabase.load_or_create("myproject")
|
|
407
|
+
|
|
408
|
+
db.save_user(client.users.get_user(156))
|
|
409
|
+
db.save_game(client.games.get_game(2753915549))
|
|
410
|
+
|
|
411
|
+
user_data = db.get_user(156)
|
|
412
|
+
all_users = db.get_all_users()
|
|
413
|
+
all_games = db.get_all_games()
|
|
414
|
+
|
|
415
|
+
db.set("tracked_ids", [156, 261, 1234])
|
|
416
|
+
val = db.get("tracked_ids")
|
|
417
|
+
|
|
418
|
+
print(db.stats())
|
|
419
|
+
# {'users': 10, 'games': 5, 'session_keys': 3, 'log_entries': 42}
|
|
420
|
+
|
|
421
|
+
db.close()
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Events
|
|
427
|
+
|
|
428
|
+
```python
|
|
429
|
+
from roboat import EventPoller
|
|
430
|
+
|
|
431
|
+
poller = EventPoller(client, interval=30)
|
|
432
|
+
|
|
433
|
+
@poller.on_friend_online
|
|
434
|
+
def on_online(user):
|
|
435
|
+
print(f"{user.display_name} came online!")
|
|
436
|
+
|
|
437
|
+
@poller.on_new_friend
|
|
438
|
+
def on_friend(user):
|
|
439
|
+
print(f"New friend: {user.display_name}")
|
|
440
|
+
|
|
441
|
+
poller.track_game(2753915549, milestone_step=1_000_000)
|
|
442
|
+
|
|
443
|
+
@poller.on("visit_milestone")
|
|
444
|
+
def on_milestone(game, count):
|
|
445
|
+
print(f"{game.name} hit {count:,} visits!")
|
|
446
|
+
|
|
447
|
+
poller.start(interval=30)
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## Pagination
|
|
453
|
+
|
|
454
|
+
```python
|
|
455
|
+
from roboat.utils import Paginator
|
|
456
|
+
|
|
457
|
+
for follower in Paginator(
|
|
458
|
+
lambda cursor: client.friends.get_followers(156, limit=100, cursor=cursor)
|
|
459
|
+
):
|
|
460
|
+
print(follower)
|
|
461
|
+
|
|
462
|
+
top_500 = Paginator(
|
|
463
|
+
lambda c: client.friends.get_followers(156, limit=100, cursor=c),
|
|
464
|
+
max_items=500,
|
|
465
|
+
).collect()
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## Error Handling
|
|
471
|
+
|
|
472
|
+
```python
|
|
473
|
+
from roboat import UserNotFoundError, RateLimitedError, RoboatAPIError
|
|
474
|
+
from roboat.utils import retry
|
|
475
|
+
|
|
476
|
+
@retry(max_attempts=3, backoff=2.0)
|
|
477
|
+
def safe_get(user_id):
|
|
478
|
+
return client.users.get_user(user_id)
|
|
479
|
+
|
|
480
|
+
try:
|
|
481
|
+
user = safe_get(99999999999)
|
|
482
|
+
except UserNotFoundError:
|
|
483
|
+
print("Not found")
|
|
484
|
+
except RateLimitedError:
|
|
485
|
+
print("Rate limited")
|
|
486
|
+
except RoboatAPIError as e:
|
|
487
|
+
print(f"Error: {e}")
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
## Analytics
|
|
493
|
+
|
|
494
|
+
```python
|
|
495
|
+
from roboat.analytics import Analytics
|
|
496
|
+
|
|
497
|
+
an = Analytics(client)
|
|
498
|
+
|
|
499
|
+
print(an.user_report(156))
|
|
500
|
+
print(an.compare_games([2753915549, 286090429]))
|
|
501
|
+
print(an.group_report(7))
|
|
502
|
+
print(an.rich_leaderboard_str([2753915549, 286090429], by="visits"))
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
|
|
507
|
+
## Terminal Commands
|
|
508
|
+
|
|
509
|
+
| Command | Description |
|
|
510
|
+
|:---|:---|
|
|
511
|
+
| `start <userid>` | Begin session (required first) |
|
|
512
|
+
| `auth` | OAuth login via browser |
|
|
513
|
+
| `whoami` | Current session info |
|
|
514
|
+
| `newdb / loaddb / listdb` | Database management |
|
|
515
|
+
| `user <id>` | User profile |
|
|
516
|
+
| `game <id>` | Game stats |
|
|
517
|
+
| `friends / followers <id>` | Social info |
|
|
518
|
+
| `likes <id>` | Vote stats |
|
|
519
|
+
| `search user/game <kw>` | Search |
|
|
520
|
+
| `presence / avatar <id>` | Status and avatar |
|
|
521
|
+
| `servers <placeid>` | Active servers |
|
|
522
|
+
| `badges <id>` | Game badges |
|
|
523
|
+
| `catalog <keyword>` | Shop search |
|
|
524
|
+
| `trades` | Trade list |
|
|
525
|
+
| `inventory / rap <id>` | Limiteds and RAP |
|
|
526
|
+
| `messages` | Private messages |
|
|
527
|
+
| `owns <uid> <assetid>` | Ownership check |
|
|
528
|
+
| `universe <id>` | Dev universe info |
|
|
529
|
+
| `save user/game <id>` | Save to DB |
|
|
530
|
+
| `cache [clear]` | Cache stats |
|
|
531
|
+
| `watch <id>` | Visit milestone alerts |
|
|
532
|
+
| `history / clear / exit` | Utility |
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## License
|
|
537
|
+
|
|
538
|
+
MIT
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
<div align="center">
|
|
543
|
+
|
|
544
|
+
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:A78BFA,100:6EE7F7&height=120§ion=footer" width="100%"/>
|
|
545
|
+
|
|
546
|
+
**Built for the Roblox developer community**
|
|
547
|
+
|
|
548
|
+
[](https://github.com/valeoncehadadream/roboat)
|
|
549
|
+
|
|
550
|
+
</div>
|