Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation fixes #76

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dev-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install dependencies
run: |
pip install git+https://github.com/squidfunk/mkdocs-material.git@8.0.0b2
pip install mkdocstrings httpx mkdocs-literate-nav mkdocs-gen-files mike
pip install mkdocstrings[python] httpx mkdocs-literate-nav mkdocs-gen-files mike

- name: Configure Git user
run: |
Expand Down
2 changes: 1 addition & 1 deletion docs/bases.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ user = client.get_base_user(1)
async for username in user.username_history():
print(username)
```
This code is functionally identical but won't send any unnecessary requests.
This code is functionally identical but won't send any unnecessary requests. Note that `get_base_XYZ` functions are not asynchronous, so you do not need to await them.
34 changes: 34 additions & 0 deletions docs/tutorial/group-bot/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Discord-Roblox Group Management Bot
One of the most common uses of ro.py is for Discord-Roblox bots, usually for managing groups. In this guide, we'll create a bot from scratch using [discord.py](https://discordpy.readthedocs.io/en/stable/) and ro.py to manage a group.
While this will all work on its own, you will likely need to make modifications to have some parts work in your own bot (if you already have one).
!!! note
This tutorial uses discord.py prefix commands, which will require the Message Content intent to be enabled on
September 1st, 2022. Concepts related to ro.py will likely still apply when using application commands, but this
guide does not use them.

## Prerequisites
* Basic knowledge (and how to use [async/await syntax](https://realpython.com/async-io-python/#the-asyncawait-syntax-and-native-coroutines)) and installation of Python
* Basic knowledge of discord.py

## Setup
Before we get started, there are 2 packages we need to install. Use the following commands in your terminal:
```
pip install discord.py
pip install roblox
```
Next, create a new Python file wherever on your system that you'd like. Once you've done so, open it in your favorite editor, and add the following:
```python title="main.py"
import discord
from discord.ext import commands
import roblox

bot = commands.Bot("!", intents=discord.Intents.default())
# If your bot will do other things, you may need different intents. Check https://discordpy.readthedocs.io/en/stable/intents.html for information on how to use intents.
client = roblox.Client("YOUR_TOKEN_HERE")
```
Here, we've imported the discord.py package, the commands extension, and the ro.py package, then created a new Discord Bot Client and Roblox Client. Replace `YOUR_TOKEN_HERE` with your [.ROBLOSECURITY](https://ro.py.jmk.gg/dev/roblosecurity/) token.
!!! danger
Under no circumstances should you give anyone else access to your .ROBLOSECURITY token, as this gives them access
to your account. It is recommended to use an alternate account for this, and one with only the permissions necessary
for your bot to function. It is also recommended to [enable 2FA](https://en.help.roblox.com/hc/articles/212459863),
as this makes it much more difficult for some to randomly gain access to your account, even if they know your password.
16 changes: 8 additions & 8 deletions roblox/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def get_base_user(self, user_id: int) -> BaseUser:

!!! note
This method does not send any requests - it just generates an object.
For more information on bases, please see [Bases](/bases).
For more information on bases, please see [Bases](/dev/bases).

Arguments:
user_id: A Roblox user ID.
Expand Down Expand Up @@ -282,7 +282,7 @@ def get_base_group(self, group_id: int) -> BaseGroup:

!!! note
This method does not send any requests - it just generates an object.
For more information on bases, please see [Bases](/bases).
For more information on bases, please see [Bases](/dev/bases).

Arguments:
group_id: A Roblox group ID.
Expand Down Expand Up @@ -335,7 +335,7 @@ def get_base_universe(self, universe_id: int) -> BaseUniverse:

!!! note
This method does not send any requests - it just generates an object.
For more information on bases, please see [Bases](/bases).
For more information on bases, please see [Bases](/dev/bases).

Arguments:
universe_id: A Roblox universe ID.
Expand Down Expand Up @@ -389,7 +389,7 @@ def get_base_place(self, place_id: int) -> BasePlace:

!!! note
This method does not send any requests - it just generates an object.
For more information on bases, please see [Bases](/bases).
For more information on bases, please see [Bases](/dev/bases).

Arguments:
place_id: A Roblox place ID.
Expand Down Expand Up @@ -430,7 +430,7 @@ def get_base_asset(self, asset_id: int) -> BaseAsset:

!!! note
This method does not send any requests - it just generates an object.
For more information on bases, please see [Bases](/bases).
For more information on bases, please see [Bases](/dev/bases).

Arguments:
asset_id: A Roblox asset ID.
Expand Down Expand Up @@ -484,7 +484,7 @@ def get_base_plugin(self, plugin_id: int) -> BasePlugin:

!!! note
This method does not send any requests - it just generates an object.
For more information on bases, please see [Bases](/bases).
For more information on bases, please see [Bases](/dev/bases).

Arguments:
plugin_id: A Roblox plugin ID.
Expand Down Expand Up @@ -525,7 +525,7 @@ def get_base_badge(self, badge_id: int) -> BaseBadge:

!!! note
This method does not send any requests - it just generates an object.
For more information on bases, please see [Bases](/bases).
For more information on bases, please see [Bases](/dev/bases).

Arguments:
badge_id: A Roblox badge ID.
Expand All @@ -542,7 +542,7 @@ def get_base_gamepass(self, gamepass_id: int) -> BaseGamePass:

!!! note
This method does not send any requests - it just generates an object.
For more information on bases, please see [Bases](/bases).
For more information on bases, please see [Bases](/dev/bases).

Arguments:
gamepass_id: A Roblox gamepass ID.
Expand Down