From 50c9e7767d0f83d9bee08a88b61bb89445389517 Mon Sep 17 00:00:00 2001 From: Will Date: Sat, 9 Dec 2017 19:44:34 -0500 Subject: [PATCH] [V3 Dev] Fix mock command (#1156) --- redbot/core/dev_commands.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/redbot/core/dev_commands.py b/redbot/core/dev_commands.py index ed71127a5..3ee48e710 100644 --- a/redbot/core/dev_commands.py +++ b/redbot/core/dev_commands.py @@ -4,6 +4,7 @@ import io import textwrap import traceback from contextlib import redirect_stdout +from copy import copy import discord from discord.ext import commands @@ -286,17 +287,11 @@ class Dev: The prefix must not be entered. """ - # Since we have stateful objects now this might be pretty bad - # Sorry Danny - old_author = ctx.author - old_content = ctx.message.content - ctx.message.author = user - ctx.message.content = ctx.prefix + command + msg = copy(ctx.message) + msg.author = user + msg.content = ctx.prefix + command - await ctx.bot.process_commands(ctx.message) - - ctx.message.author = old_author - ctx.message.content = old_content + ctx.bot.dispatch('message', msg) @commands.command(name="mockmsg") @checks.is_owner()