Exception handling

The library dispatches events for easy exception handling

IPC_ERROR

  • endpoint: The name of the endpoint that failed while making an request

  • exc: The raw Exception class

import discord
from typing import Dict
from discord.ext import commands, ipc
from discord.ext.ipc.server import Server

class MyBot(commands.Bot):
    def __init__(self) -> None:
        intents = discord.Intents.all()

        super().__init__(
            command_prefix="$.",
            intents=intents,
        )

        self.ipc = ipc.Server(self, secret_key="🐼")

    async def setup_hook(self) -> None:
        await self.ipc.start()

    async def on_ipc_error(self, endpoint: str, exc: Exception) -> None:
        # propery handle the exception

Last updated