NAFTeam / NAFF

A Python API wrapper for Discord
https://naff.info
MIT License
117 stars 24 forks source link

feat: role.move function #735

Closed Wolfhound905 closed 1 year ago

Wolfhound905 commented 1 year ago

What type of pull request is this?

Description

The library is currently lacking an intuitive way to move a role's position.

Changes

Test Scenario(s)

from naff.client import Client
from naff import listen

bot = Client(debug_scope=<guild_id>)

@listen()
async def on_startup():
    print("Bot is ready!")
    guild = await bot.fetch_guild(<guild_id>)
    role = await guild.fetch_role(<role_id>)
    await role.move(len(guild.roles) - 2) # Moving the role 2 from top role (@@everyone)

bot.start("token")

Checklist