T
T
TanderOFF2021-04-13 23:22:44
Python
TanderOFF, 2021-04-13 23:22:44

How to pick up several roles at once?

Hello , there are 30 ( defined ) roles for a member . How to pick them up without creating an array of
role = 1333304
role2 = 303939 and so on. It would be easier to write the id of the roles in one line and pick up these roles with these id from this line.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-04-14
@TanderOFF

Write a function that takes such a string and turns it into an array. The remove_roles()
API allows you to specify multiple roles at once, just unpack the array into an argument list via *.

input_str = '123 456 789'
role_ids = input_str.split()
reason = 'Потому что гладиолус!' #или None
target_member.remove_roles(*role_ids, reason=reason)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question