/plu/ral/plu/ral
Invite Bot
Support Server
Donate
GitHub
Invite Bot
Support Server
Donate
GitHub
  • User Guide

    • Getting Started
    • Importing
    • Config
    • Members
    • Groups
    • Proxying
    • Userproxies
    • Multiple Accounts
    • FAQ
    • Command Reference
  • Server Guide

    • Config
    • Automod
  • Third Party Applications

    • API Reference
    • Adding Logging Support
  • Information

    • Privacy Policy
    • Terms of Service
    • Donate

Adding Logging Support

This page is intended for developers who want to integrate with /plu/ral.

If you're a user looking to clean the logs of a bot that doesn't have native support, see the Log Clean Config page.

Instructions

Checking if a message exists (HEAD /messages/:channel_id/:message_id) does not require authentication, however the unauthenticated rate limit is very low, so if your bot anything more than an in-house bot for a small server, you should create an application with the /api command.

You can check either the id of the message that was deleted OR the id of the proxied message.

See the API Documentation for all endpoints and response examples.

Basic Example

cURL
curl -X HEAD 'https://api.plural.gg/messages/{message_id}' \
  -H 'Authorization: your_token_here'
Python (aiohttp)
pip install aiohttp
from aiohttp import ClientSession

async def check_plural(message_id: int | str) -> bool:
    async with ClientSession(
        base_url='https://api.plural.gg',
        headers={'Authorization': 'your_token_here'}
    ) as session, session.head(
        f'/messages/{message_id}'
    ) as response:
        return response.status == 200

async def on_message_delete(message: Message) -> None:
    if message.author.bot and await check_plural(message.id):
        print(f'message {message.id} was deleted by /plu/ral; skipping')
        return
    ...
Python (requests)
pip install requests
# ! requests uses blocking i/o, use aiohttp instead
# ! this code is only here for demonstration purposes
import requests

def check_plural(message_id: int | str) -> bool:
    response = requests.get(
        f'https://api.plural.gg/messages/{message_id}',
        headers={'Authorization': 'your_token_here'}
    )

    return response.status_code == 200

async def on_message_delete(message: Message) -> None:
    if message.author.bot and await check_plural(message.id):
        print(f'message {message.id} was deleted by /plu/ral; skipping')
        return
    ...
Edit this page on GitHub
Last Updated:
Contributors: tyrantlink
Prev
API Reference