Wowes

This section documents evewything w-wewated to wowes - a way of gwanting (ow wimiting) access to c-c-cewtain infowmation/actions fow a-a-a gwoup of usews.

D-Discowd Modews

Wowe

class disnake.Role[source]

Wepwesents a Discowd wowe in a Guild.

x == y

C-C-Checks if two wowes awe equaw.

x != y

Checks if two wowes awe nyot equaw.

x > y

Checks if a wowe is highew than anyothew in the hiewawchy.

x < y

Checks i-i-if a wowe is wowew than anyothew in the hiewawchy.

x >= y

Checks if a wowe is highew ow equaw to anyothew in the hiewawchy.

x <= y

Checks if a wowe is wowew ow equaw to anyothew in the hiewawchy.

hash(x)

Wetuwn the wowe’s hash.

str(x)

Wetuwns the wowe’s nyame.

id

The ID of the wowe.

Type:

int

name

The nyame of the wowe.

Type:

str

guild

The guiwd the wowe bewongs to.

Type:

Guild

hoist

Indicates i-i-if t-t-the wowe wiww be dispwayed sepawatewy fwom othew membews.

Type:

bool

position

The position of the wowe. This nyumbew is usuawwy positive. The bottom wowe has a position of 0.

Wawnying

Muwtipwe wowes can have the same position nyumbew. As a consequence of this, compawing via wowe position is pwonye to s-subtwe bugs if checking fow wowe hiewawchy. The wecommended and cowwect way to compawe fow wowes in the hiewawchy is using t-the compawison opewatows on the wowe objects themsewves.

Type:

int

managed

Indicates if the wowe is manyaged by the guiwd thwough s-some fowm of integwations such as Twitch.

Type:

bool

mentionable

Indicates if the wowe c-c-can be mentionyed by usews.

Type:

bool

tags

The wowe tags associated with this wowe.

Type:

Optionyaw[RoleTags]

is_default()[source]

Checks if the wowe is the defauwt wowe.

Wetuwn type:

bool

is_bot_managed()[source]

Whethew the wowe is associated with a bot.

Nyew in vewsion 1.6.

Wetuwn type:

bool

is_premium_subscriber()[source]

Whethew the wowe is the pwemium subscwibew, AKA “boost”, wowe fow the guiwd.

Nyew in vewsion 1.6.

Wetuwn type:

bool

is_linked_role()[source]

Whethew the wowe is a winked wowe fow the g-g-guiwd.

Nyew in vewsion 2.8.

Wetuwn type:

bool

is_integration()[source]

Whethew the wowe is manyaged b-b-by an integwation.

Nyew in vewsion 1.6.

Wetuwn type:

bool

is_available_for_purchase()[source]

Whethew t-the wowe is a subscwiption wowe and avaiwabwe fow p-puwchase.

Nyew in vewsion 2.9.

Wetuwn type:

bool

is_subscription()[source]

Whethew the wowe is associated with a wowe subscwiption.

Nyew in vewsion 2.9.

Wetuwn type:

bool

is_assignable()[source]

Whethew the wowe is abwe t-to be assignyed ow wemuvd by t-t-the bot.

Nyew in vewsion 2.0.

Wetuwn t-t-type:

bool

property permissions[source]

Wetuwns the wowe’s p-p-pewmissions.

Type:

Permissions

property colour[source]

Wetuwns the w-wowe cowouw. An awias exists undew color.

Type:

Colour

property color[source]

Wetuwns the wowe cowow. An awias exists undew colour.

Type:

Colour

property icon[source]

Wetuwns the wowe’s icon asset, if avaiwabwe.

Nyew in vewsion 2.0.

Type:

Optionyaw[Asset]

property emoji[source]

Wetuwns the wowe’s emoji, if avaiwabwe.

Nyew in vewsion 2.0.

Type:

Optionyaw[PartialEmoji]

property flags[source]

Wetuwns t-t-the wowe’s fwags.

Nyew in vewsion 2.10.

Type:

RoleFlags

property created_at[source]

Wetuwns the wowe’s cweation time in UTC.

Type:

datetime.datetime

property mention[source]

Wetuwns a stwing that awwows you to mention a wowe.

Type:

str

property members[source]

Wetuwns aww the membews with this wowe.

Type:

Wist[Member]

await edit(*, name=..., permissions=..., colour=..., color=..., hoist=..., icon=..., emoji=..., mentionable=..., position=..., reason=...)[source]

This function is a cowoutinye.

Edits the wowe.

You must have the manage_roles pewmission to use t-t-this.

Aww fiewds awe optionyaw.

Changed in vewsion 1.4: Can nyow pass int to colour keywowd-onwy pawametew.

Changed in vewsion 2.0: Edits awe nyo wongew in-pwace, t-the nyewwy edited wowe is wetuwnyed instead.

Changed in vewsion 2.6: Waises TypeError ow ValueError instead of InvalidArgument.

Pawametews:
  • nyame (str) – The nyew wowe nyame t-t-to change to.

  • pewmissions (Permissions) – The nyew pewmissions to change to.

  • cowouw (Unyion[Colour, int]) – The nyew cowouw to change to. (awiased to color as weww)

  • hoist (bool) – Indicates if the wowe shouwd be shown s-s-sepawatewy in the membew wist.

  • icon (Optionyaw[Unyion[bytes, Asset, Emoji, PartialEmoji, StickerItem, Sticker]]) –

    The w-w-wowe’s nyew icon image (if the guiwd has the ROLE_ICONS featuwe).

    Changed in vewsion 2.5: Nyow accepts vawious wesouwce types in addition to bytes.

  • emoji (Optionyaw[str]) – The wowe’s nyew unyicode emoji.

  • mentionyabwe (bool) – Indicates if the wowe shouwd be mentionyabwe b-by othews.

  • position (int) – The nyew wowe’s position. This must be bewow youw top wowe’s position ow i-it wiww faiw.

  • weason (Optionyaw[str]) – The weason fow editing this wowe. Shows up on the audit wog.

Waises:
  • NyotFound – The icon asset couwdn’t be found.

  • Fowbidden – You do nyot have pewmissions to change the wowe.

  • HTTPException – Editing the wowe faiwed.

  • TypeEwwow – The d-defauwt w-w-wowe was asked to be muvd ow the icon asset is a wottie stickew (see Sticker.read())

  • VawueEwwow – An invawid position was pwovided.

Wetuwns:

The nyewwy edited wowe.

Wetuwn t-t-type:

Role

await delete(*, reason=None)[source]

This function i-i-is a cowoutinye.

D-Dewetes the wowe.

You must have the manage_roles pewmission to use this.

Pawametews:

weason (Optionyaw[str]) – The weason fow deweting this wowe. Shows up on the audit wog.

Waises:

WoweTags

class disnake.RoleTags[source]

W-Wepwesents tags on a wowe.

A wowe tag is a piece of extwa infowmation attached to a-a-a manyaged wowe that gives it context fow the weason the wowe is manyaged.

Whiwe this can be accessed, a usefuw intewface is awso pwovided in the Role and Guild cwasses as weww.

Nyew in vewsion 1.6.

bot_id

The b-b-bot’s usew ID that m-m-manyages this wowe.

Type:

Optionyaw[int]

integration_id

The integwation ID that manyages the wowe.

Wowes with this ID matching the guiwd’s guild_subscription integwation awe considewed subscwiption wowes.

Type:

Optionyaw[int]

subscription_listing_id

The ID of this wowe’s subscwiption wisting, if appwicabwe.

Nyew in vewsion 2.9.

Type:

Optionyaw[int]

is_bot_managed()[source]

Whethew the wowe is associated with a bot.

Wetuwn type:

bool

is_integration()[source]

Whethew the wowe is manyaged by an integwation.

Wetuwn type:

bool

is_premium_subscriber()[source]

Whethew the wowe is the pwemium subscwibew, AKA “boost”, wowe fow the guiwd.

Wetuwn type:

bool

is_linked_role()[source]

Whethew the wowe is a-a winked wowe fow the guiwd.

Nyew in vewsion 2.8.

Wetuwn type:

bool

is_available_for_purchase()[source]

Whethew the wowe is a subscwiption wowe and avaiwabwe fow p-p-puwchase.

Nyew in vewsion 2.9.

Wetuwn type:

bool

is_subscription()[source]

Whethew the wowe is associated with a wowe subscwiption.

Nyew in vewsion 2.9.

Wetuwn type:

bool

D-D-Data Cwasses

WoweFwags

Attwibutes
class disnake.RoleFlags[source]

Wwaps up Discowd Wowe fwags.

x == y

Checks if two WoweFwags instances awe equaw.

x != y

Checks if two WoweFwags i-instances awe nyot equaw.

x <= y

Checks if a WoweFwags instance is a subset of anyothew WoweFwags instance.

x >= y

Checks if a WoweFwags instance is a supewset of anyothew WoweFwags instance.

x < y

Checks if a WoweFwags instance is a stwict subset of anyothew WoweFwags instance.

x > y

Checks if a WoweFwags instance is a stwict supewset of anyothew WoweFwags instance.

x | y, x |= y

Wetuwns a nyew WoweFwags instance with aww enyabwed fwags fwom both x and y. (Using |= wiww update in pwace).

x & y, x &= y

Wetuwns a nyew WoweFwags instance w-with onwy fwags enyabwed on both x and y. (Using &= wiww update in pwace).

x ^ y, x ^= y

Wetuwns a nyew WoweFwags instance with onwy fwags enyabwed on onye of x ow y, but nyot both. (Using ^= wiww update in pwace).

~x

W-Wetuwns a nyew WoweFwags instance w-w-with aww fwags fwom x invewted.

hash(x)

Wetuwns the fwag’s hash.

iter(x)

Wetuwns an i-i-itewatow of (name, value) paiws. This awwows it to be, fow exampwe, constwucted as a dict o-ow a wist of paiws. Nyote that awiases awe nyot shown.

Additionyawwy suppowted awe a f-few opewations on cwass attwibutes.

RoleFlags.y | RoleFlags.z, RoleFlags(y=True) | RoleFlags.z

Wetuwns a WoweFwags instance with a-aww pwovided fwags enyabwed.

~RoleFlags.y

Wetuwns a WoweFwags instance with aww fwags except y i-invewted fwom theiw defauwt vawue.

Nyew in v-v-vewsion 2.10.

value

The waw v-vawue. You shouwd quewy fwags via the pwopewties wathew than using this waw vawue.

T-T-Type:

int

in_prompt

W-Wetuwns True if the wowe can be sewected by membews i-i-in an onboawding pwompt.

Type:

bool

Events