PyDrocsid.util
¶
attachment_to_file
async
¶
attachment_to_file(attachment: Attachment) -> File
Convert an attachment to a file
Source code in PyDrocsid/util.py
113 114 115 116 117 118 |
|
calculate_edit_distance ¶
calculate_edit_distance(a: str, b: str) -> int
Calculate edit distance (Levenshtein distance) between two strings.
Source code in PyDrocsid/util.py
102 103 104 105 106 107 108 109 110 |
|
check_role_assignable ¶
check_role_assignable(role: Role) -> None
Check whether the bot could assign and unassign a given role.
Source code in PyDrocsid/util.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
check_wastebasket
async
¶
check_wastebasket(message: Message, member: Member, emoji: PartialEmoji, footer: str, permission: BasePermission) -> int | None
Check if a user has reacted with on an embed originally sent by the bot and if the user is allowed to delete or collapse this embed.
Parameters:
-
message
(
Message
) –the message the user has reacted on
-
member
(
Member
) –the user who added the reaction
-
emoji
(
PartialEmoji
) –the emoji the user reacted with
-
footer
(
str
) –the embed footer to search for
-
permission
(
BasePermission
) –the permission required for deletion
Returns:
-
int | None
–the id of the user who originally requested this embed if the reacting user is allowed to delete this embed, otherwise None
Source code in PyDrocsid/util.py
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 |
|
is_teamler
async
¶
is_teamler(member: Member) -> bool
Return whether a given member is a team member.
Source code in PyDrocsid/util.py
34 35 36 37 |
|
measure_latency ¶
measure_latency() -> float | None
Measure latency to discord.com.
Source code in PyDrocsid/util.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
read_complete_message
async
¶
read_complete_message(message: Message) -> tuple[str, list[File], Embed | None]
Extract content, attachments and embed from a given message.
Source code in PyDrocsid/util.py
131 132 133 134 135 136 137 138 139 140 141 |
|
read_normal_message
async
¶
read_normal_message(bot: Bot, channel: TextChannel, author: Member) -> tuple[str, list[File]]
Read a message and return content and attachments.
Source code in PyDrocsid/util.py
121 122 123 124 125 126 127 128 |
|
send_editable_log
async
¶
send_editable_log(channel: Messageable, title: str, description: str, name: str, value: str, *, colour: int | None = None, inline: bool = False, force_resend: bool = False, force_new_embed: bool = False, force_new_field: bool = False, **kwargs: Any) -> Message
Send a log embed into a given channel which can be updated later.
Parameters:
-
channel
(
Messageable
) –the channel into which the messages should be sent
-
title
(
str
) –the embed title
-
description
(
str
) –the embed description
-
name
(
str
) –the field name
-
value
(
str
) –the field value
-
colour
(
int | None
) –the embed color
-
inline
(
bool
) –inline parameter of embed field
-
force_resend
(
bool
) –whether to force a resend of the embed instead of editing it
-
force_new_embed
(
bool
) –whether to always send a new embed instead of extending the previous embed
-
force_new_field
(
bool
) –whether to always create a new field instead of editing the last field
Source code in PyDrocsid/util.py
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 |
|