MCPcopy Create free account
hub / github.com/Botloader/botloader / discord_request

Function discord_request

components/runtime/src/extensions/discord.rs:293–308  ·  view source on GitHub ↗
(
    state: &Rc<RefCell<OpState>>,
    f: impl Future<Output = Result<T, twilight_http::Error>> + Send + 'static,
)

Source from the content-addressed store, hash-verified

291}
292
293pub async fn discord_request<T: Send + Sync + 'static>(
294 state: &Rc<RefCell<OpState>>,
295 f: impl Future<Output = Result<T, twilight_http::Error>> + Send + 'static,
296) -> Result<T, AnyError> {
297 let rt_handle = {
298 let state = state.borrow();
299 let rt_ctx: &RuntimeContext = state.borrow();
300 rt_ctx.main_tokio_runtime.clone()
301 };
302
303 rt_handle
304 .spawn(f)
305 .await
306 .unwrap()
307 .map_err(|err| handle_discord_error(state, err))
308}
309
310pub async fn discord_request_with_extra_error<T: Send + Sync + 'static>(
311 state: &Rc<RefCell<OpState>>,

Calls 2

handle_discord_errorFunction · 0.85
spawnMethod · 0.45

Tested by

no test coverage detected