EnokiUN / voltage

A simple asynchronous pythonic wrapper for the revolt api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

keyerror 'content'

Motzumoto opened this issue · comments

commented

Summary

Wrapper error

Reproduction Steps

Do literally anything and you'll get this error

Minimal Reproducible Code

import logging
import voltage
from voltage.ext import commands
from bot import evolve
logger = logging.getLogger(__name__)


class ping(commands.SubclassedCog):
    def __init__(self, bot: evolve):
        self.bot = bot
        self.name = "ping"


    @commands.command()
    async def ping(self, ctx):
        """Ping the bot"""
        embed = voltage.SendableEmbed(
            title="Ping",
            description="Hi I'm alive!",
        )
        await ctx.send(embed=embed)


def setup(bot: evolve) -> None:
    return ping(bot)

Expected Results

The command responds just fine but this error is given in my console

Traceback (most recent call last):
  File "/home/lain/.local/lib/python3.10/site-packages/voltage/internals/ws.py", line 136, in handle_event
    await func(payload)
  File "/home/lain/.local/lib/python3.10/site-packages/voltage/internals/ws.py", line 161, in handle_message
    await self.dispatch("message", self.cache.add_message(payload))
  File "/home/lain/.local/lib/python3.10/site-packages/voltage/ext/commands/client.py", line 254, in dispatch
    await func(*args, **kwargs)
  File "/home/lain/.local/lib/python3.10/site-packages/voltage/ext/commands/client.py", line 291, in handle_commands
    return await self.commands[command].invoke(
  File "/home/lain/.local/lib/python3.10/site-packages/voltage/ext/commands/command.py", line 252, in invoke
    return await coro
  File "/mnt/c/Users/Lain/Desktop/Developer/revolt-evolve/cogs/ping.py", line 21, in ping
    await ctx.send(embed=embed)
  File "/home/lain/.local/lib/python3.10/site-packages/voltage/messageable.py", line 174, in send
    msg = self.cache.add_message(message)
  File "/home/lain/.local/lib/python3.10/site-packages/voltage/internals/cache.py", line 243, in add_message
    message = Message(data, self)
  File "/home/lain/.local/lib/python3.10/site-packages/voltage/message.py", line 130, in __init__
    self.content = data["content"]
KeyError: 'content'

Actual Results

Given an error

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

This would be because embeds could not be sent without content, which has changed I would guess. Though I can try to fix this :)

commented

❤️

commented

Should be fixed now