MCPcopy
hub / github.com/Rapptz/discord.py / fetch_message

Method fetch_message

discord/webhook/sync.py:1154–1198  ·  view source on GitHub ↗

Retrieves a single :class:`~discord.SyncWebhookMessage` owned by this webhook. .. versionadded:: 2.0 Parameters ------------ id: :class:`int` The message ID to look for. thread: :class:`~discord.abc.Snowflake` The thread to look in.

(self, id: int, /, *, thread: Snowflake = MISSING)

Source from the content-addressed store, hash-verified

1152 return msg
1153
1154 def fetch_message(self, id: int, /, *, thread: Snowflake = MISSING) -> SyncWebhookMessage:
1155 """Retrieves a single :class:`~discord.SyncWebhookMessage` owned by this webhook.
1156
1157 .. versionadded:: 2.0
1158
1159 Parameters
1160 ------------
1161 id: :class:`int`
1162 The message ID to look for.
1163 thread: :class:`~discord.abc.Snowflake`
1164 The thread to look in.
1165
1166 Raises
1167 --------
1168 ~discord.NotFound
1169 The specified message was not found.
1170 ~discord.Forbidden
1171 You do not have the permissions required to get a message.
1172 ~discord.HTTPException
1173 Retrieving the message failed.
1174 ValueError
1175 There was no token associated with this webhook.
1176
1177 Returns
1178 --------
1179 :class:`~discord.SyncWebhookMessage`
1180 The message asked for.
1181 """
1182
1183 if self.token is None:
1184 raise ValueError('This webhook does not have a token associated with it')
1185
1186 thread_id: Optional[int] = None
1187 if thread is not MISSING:
1188 thread_id = thread.id
1189
1190 adapter: WebhookAdapter = _get_webhook_adapter()
1191 data = adapter.get_webhook_message(
1192 self.id,
1193 self.token,
1194 id,
1195 session=self.session,
1196 thread_id=thread_id,
1197 )
1198 return self._create_message(data, thread=thread)
1199
1200 @overload
1201 def edit_message(

Callers

nothing calls this directly

Calls 3

_create_messageMethod · 0.95
_get_webhook_adapterFunction · 0.85
get_webhook_messageMethod · 0.45

Tested by

no test coverage detected