CraftSpider / dpytest

A package that assists in writing tests for discord.py
MIT License
103 stars 24 forks source link

DM Channel not implemented #7

Closed GsakuL closed 4 years ago

GsakuL commented 4 years ago

My Bot uses a custom help command-cog (which i want to test). It sends the information via DM to the author: ctx.author.send(text) . discordpy automatically fetches the DM channel

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotImplementedError: Operation occured that isn't captured by the tests framework. https://discordapp.com/api/v7/users/@me/channels

Edit: Example

import discord.ext.test as dpytest
import pytest
from discord import Guild
from discord.ext.commands import Bot

@pytest.mark.asyncio
async def test_permission():
    bot = Bot("!", formatter=None)
    dpytest.configure(bot, num_members=3, num_channels=2)
    guild: Guild = bot.guilds[0]
    await guild.members[0].send("hi")
    # ...
CraftSpider commented 4 years ago

I'll look into adding the DM endpoint to the supported endpoints

CraftSpider commented 4 years ago

Support for DM channels is in release 0.0.19