Suppress embeds in messages.
This commit is contained in:
parent
a781f737b0
commit
2e848db333
@ -96,14 +96,14 @@ class FjerkroaBot(commands.Bot):
|
|||||||
response.staff = f"User {message.user} try to hack the AI."
|
response.staff = f"User {message.user} try to hack the AI."
|
||||||
if response.staff is not None and self.staff_channel is not None:
|
if response.staff is not None and self.staff_channel is not None:
|
||||||
async with self.staff_channel.typing():
|
async with self.staff_channel.typing():
|
||||||
await self.staff_channel.send(response.staff)
|
await self.staff_channel.send(response.staff, suppress_embeds=True)
|
||||||
if not response.answer_needed:
|
if not response.answer_needed:
|
||||||
return
|
return
|
||||||
if response.picture is not None:
|
if response.picture is not None:
|
||||||
images = [discord.File(fp=await airesponder.draw(response.picture), filename="image.png")]
|
images = [discord.File(fp=await airesponder.draw(response.picture), filename="image.png")]
|
||||||
await channel.send(response.answer, files=images)
|
await channel.send(response.answer, files=images, suppress_embeds=True)
|
||||||
else:
|
else:
|
||||||
await channel.send(response.answer)
|
await channel.send(response.answer, suppress_embeds=True)
|
||||||
|
|
||||||
async def close(self):
|
async def close(self):
|
||||||
self.observer.stop()
|
self.observer.stop()
|
||||||
|
|||||||
@ -72,7 +72,7 @@ class TestFunctionality(TestBotBase):
|
|||||||
message = self.create_message("Hello there! How are you?")
|
message = self.create_message("Hello there! How are you?")
|
||||||
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
|
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
|
||||||
await self.bot.on_message(message)
|
await self.bot.on_message(message)
|
||||||
message.channel.send.assert_called_once_with("Hello!")
|
message.channel.send.assert_called_once_with("Hello!", suppress_embeds=True)
|
||||||
|
|
||||||
async def test_on_message_event2(self) -> None:
|
async def test_on_message_event2(self) -> None:
|
||||||
async def acreate(*a, **kw):
|
async def acreate(*a, **kw):
|
||||||
@ -85,7 +85,7 @@ class TestFunctionality(TestBotBase):
|
|||||||
message = self.create_message("Hello there! How are you?")
|
message = self.create_message("Hello there! How are you?")
|
||||||
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
|
with patch.object(openai.ChatCompletion, 'acreate', new=acreate):
|
||||||
await self.bot.on_message(message)
|
await self.bot.on_message(message)
|
||||||
message.channel.send.assert_called_once_with("Hello!")
|
message.channel.send.assert_called_once_with("Hello!", suppress_embeds=True)
|
||||||
|
|
||||||
async def test_on_message_event3(self) -> None:
|
async def test_on_message_event3(self) -> None:
|
||||||
async def acreate(*a, **kw):
|
async def acreate(*a, **kw):
|
||||||
@ -132,7 +132,7 @@ class TestFunctionality(TestBotBase):
|
|||||||
patch.object(logging, 'warning', logging_warning), \
|
patch.object(logging, 'warning', logging_warning), \
|
||||||
patch.object(aiohttp.ClientSession, 'get', new=image):
|
patch.object(aiohttp.ClientSession, 'get', new=image):
|
||||||
await self.bot.on_message(message)
|
await self.bot.on_message(message)
|
||||||
message.channel.send.assert_called_once_with("Hello!", files=[ANY])
|
message.channel.send.assert_called_once_with("Hello!", files=[ANY], suppress_embeds=True)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__mait__":
|
if __name__ == "__mait__":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user