Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.

feat: role.move function #735

Merged
merged 1 commit into from
Dec 6, 2022
Merged

feat: role.move function #735

merged 1 commit into from
Dec 6, 2022

Conversation

Wolfhound905
Copy link
Collaborator

What type of pull request is this?

  • Non-breaking code change
  • Breaking code change
  • Documentation change/addition
  • Tests change
  • CI change
  • Other: [Replace with a description]

Description

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

Changes

  • modify_guild_role_positions() now takes a list. This reflects how the API handles position changes.
  • models.Role now has the move() function

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

  • I've formatted my code with Black
  • I've added docstrings to everything I've touched
  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x
  • I've tested my changes
  • I've added tests for my code - if applicable
  • I've updated the documentation - if applicable

@LordOfPolls LordOfPolls merged commit c4beba3 into NAFTeam:dev Dec 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants