PythonistaGuild / TwitchIO

An Async Bot/API wrapper for Twitch made in Python.
https://twitchio.dev
MIT License
785 stars 163 forks source link

delete_chat_messages 404 error #458

Closed AI-Maria closed 2 months ago

AI-Maria commented 2 months ago
Traceback (most recent call last):
  File "/opt/miniconda3/envs/mar/lib/python3.11/site-packages/twitchio/client.py", line 208, in wrapped
    await func(*args)
  File "/home/denis/code/MariaAI/Chat/Chat.py", line 557, in event_message
    await chatter_user.delete_chat_messages(APP_SECRET, self.user_id, m.id)
  File "/opt/miniconda3/envs/mar/lib/python3.11/site-packages/twitchio/user.py", line 1322, in delete_chat_messages
    await self._http.delete_chat_messages(
  File "/opt/miniconda3/envs/mar/lib/python3.11/site-packages/twitchio/http.py", line 1078, in delete_chat_messages
    return await self.request(Route("DELETE", "moderation/chat", query=q, token=token))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mar/lib/python3.11/site-packages/twitchio/http.py", line 154, in request
    body, is_text = await self._request(route, path, headers, force_app_token=force_app_token)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mar/lib/python3.11/site-packages/twitchio/http.py", line 253, in _request
    raise errors.HTTPException(f"Failed to fulfill the request", reason=resp.reason, status=resp.status)
twitchio.errors.HTTPException: 404: Failed to fulfill the request: Not Found

My simplified code:

username = ''
APP_SECRET = ''

class Bot(commands.Bot):
    def __init__(self):
        super().__init__(token=APP_SECRET, prefix='?', initial_channels=[username])

    async def event_message(self, message):
        m = message
        chatter_user = await m.author.user()
        await chatter_user.delete_chat_messages(APP_SECRET, self.user_id, m.id)
github-actions[bot] commented 2 months ago

Hello! Thanks for the issue. If this is a general help question, for a faster response consider joining the official Discord Server

Else if you have an issue with the library please wait for someone to help you here.