more information, see the `MockGuild` docstring. """ spec_set = reaction_instance def __init__(self, **kwargs) -> None: _users = kwargs.pop("users", []) super().__init__(**kwargs) self.emoji = kwargs.get('emoji', MockEmoji()) self.message = kwargs.get('message', MockMessage()) user_iterator = unittest.mock.AsyncMock() user_iterator.__aiter__.return_value = _users self.users.return_value = user_iterator self.__str__.return_value = str(self.emoji) webhook_instance = discord.Webhook(data=unittest.mock.MagicMock(), session=unittest.mock.MagicMock()) class MockAsyncWebhook(CustomMockMixin, unittest.mock.MagicMock): """ A MagicMock subclass to mock Webhook objects using an AsyncWebhookAdapter. Instances of this class will follow the specifications of `discord.Webhook` instances. For more information, see the `MockGuild` docstring. """ spec_set = webhook_instance additional_spec_asyncs = ("send", "edit", "delete", "execute")
more information, see the `MockGuild` docstring. """ spec_set = reaction_instance def __init__(self, **kwargs) -> None: _users = kwargs.pop("users", []) super().__init__(**kwargs) self.emoji = kwargs.get('emoji', MockEmoji()) self.message = kwargs.get('message', MockMessage()) user_iterator = unittest.mock.AsyncMock() user_iterator.__aiter__.return_value = _users self.users.return_value = user_iterator self.__str__.return_value = str(self.emoji) webhook_instance = discord.Webhook(data=unittest.mock.MagicMock(), adapter=unittest.mock.MagicMock()) class MockAsyncWebhook(CustomMockMixin, unittest.mock.MagicMock): """ A MagicMock subclass to mock Webhook objects using an AsyncWebhookAdapter. Instances of this class will follow the specifications of `discord.Webhook` instances. For more information, see the `MockGuild` docstring. """ spec_set = webhook_instance additional_spec_asyncs = ("send", "edit", "delete", "execute")
def event_webhook(self): if self.config['event_webhook_url'] in [None, 0, ""]: return None return discord.Webhook(self.config['event_webhook_url'], adapter=discord.AsyncWebhookAdapter( self.session))