mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Dev V3] mockmsg command (#928)
This commit is contained in:
parent
48e36d3ca1
commit
6b1fc786ee
@ -250,3 +250,21 @@ class Dev:
|
|||||||
|
|
||||||
ctx.message.author = old_author
|
ctx.message.author = old_author
|
||||||
ctx.message.content = old_content
|
ctx.message.content = old_content
|
||||||
|
|
||||||
|
@commands.command(name="mockmsg")
|
||||||
|
@checks.is_owner()
|
||||||
|
async def mock_msg(self, ctx, user: discord.Member, *, content: str):
|
||||||
|
"""Bot receives a message is if it were sent by a different user.
|
||||||
|
|
||||||
|
Only reads the raw content of the message. Attachments, embeds etc. are ignored."""
|
||||||
|
old_author = ctx.author
|
||||||
|
old_content = ctx.message.content
|
||||||
|
ctx.message.author = user
|
||||||
|
ctx.message.content = content
|
||||||
|
|
||||||
|
ctx.bot.dispatch("message", ctx.message)
|
||||||
|
|
||||||
|
await asyncio.sleep(2) # If we change the author and content back too quickly,
|
||||||
|
# the bot won't process the mocked message in time.
|
||||||
|
ctx.message.author = old_author
|
||||||
|
ctx.message.content = old_content
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user