Role
Role
¶
Bases: DiscordObject
Source code in interactions/models/discord/role.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
bot_managed: bool
property
¶
Is this role owned/managed by a bot.
default: bool
property
¶
Is this the @everyone
role.
guild: Guild
property
¶
The guild object this role is from.
icon: Asset | PartialEmoji | None
property
¶
The icon of this role
Note
You have to use this method instead of the _icon
attribute, because the first does account for unicode emojis
integration: bool
property
¶
Is this role owned/managed by an integration.
is_assignable: bool
property
¶
Can this role be assigned or removed by this bot?
Note
This does not account for permissions, only the role hierarchy
is_linked_role: bool
property
¶
Is this role a linked role.
members: list[Member]
property
¶
List of members with this role
mention: str
property
¶
Returns a string that would mention the role.
delete(reason=MISSING)
async
¶
Delete this role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reason | str | Missing | An optional reason for this deletion | MISSING |
Source code in interactions/models/discord/role.py
172 173 174 175 176 177 178 179 180 |
|
edit(*, name=None, permissions=None, color=None, hoist=None, mentionable=None, icon=None, unicode_emoji=None)
async
¶
Edit this role, all arguments are optional.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name | str | None | name of the role | None |
permissions | str | None | New permissions to use | None |
color | Color | COLOR_TYPES | None | The color of the role | None |
hoist | bool | None | whether the role should be displayed separately in the sidebar | None |
mentionable | bool | None | whether the role should be mentionable | None |
icon | bytes | UPLOADABLE_TYPE | None | (Guild Level 2+) Bytes-like object representing the icon; supports PNG, JPEG and WebP | None |
unicode_emoji | str | None | (Guild Level 2+) Unicode emoji for the role; can't be used with icon | None |
Returns:
Type | Description |
---|---|
Role | Role with updated information |
Source code in interactions/models/discord/role.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
fetch_bot(*, force=False)
async
¶
Fetch the bot associated with this role if any.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
force | bool | Whether to force fetch the bot from the API. | False |
Returns:
Type | Description |
---|---|
Member | None | Member object if any |
Source code in interactions/models/discord/role.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
get_bot()
¶
Get the bot associated with this role if any.
Returns:
Type | Description |
---|---|
Member | None | Member object if any |
Source code in interactions/models/discord/role.py
104 105 106 107 108 109 110 111 112 113 114 |
|
move(position, reason=MISSING)
async
¶
Move this role to a new position.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
position | int | The new position of the role | required |
reason | str | Missing | An optional reason for this move | MISSING |
Returns:
Type | Description |
---|---|
Role | The role object |
Source code in interactions/models/discord/role.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|