mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-08 12:18:54 -05:00
[Alias] Change message deepcopy to shallow copy (#1053)
For extremely large servers (tens of thousands of members), copying the Server object can take several seconds and peg the CPU since this is a necessarily blocking operation
This commit is contained in:
parent
f3c957377d
commit
4a77e764a6
@ -3,7 +3,7 @@ from .utils.chat_formatting import box
|
|||||||
from .utils.dataIO import dataIO
|
from .utils.dataIO import dataIO
|
||||||
from .utils import checks
|
from .utils import checks
|
||||||
from __main__ import user_allowed, send_cmd_help
|
from __main__ import user_allowed, send_cmd_help
|
||||||
from copy import deepcopy
|
from copy import copy
|
||||||
import os
|
import os
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ class Alias:
|
|||||||
if alias in self.aliases[server.id]:
|
if alias in self.aliases[server.id]:
|
||||||
new_command = self.aliases[server.id][alias]
|
new_command = self.aliases[server.id][alias]
|
||||||
args = message.content[len(prefix + alias):]
|
args = message.content[len(prefix + alias):]
|
||||||
new_message = deepcopy(message)
|
new_message = copy(message)
|
||||||
new_message.content = prefix + new_command + args
|
new_message.content = prefix + new_command + args
|
||||||
await self.bot.process_commands(new_message)
|
await self.bot.process_commands(new_message)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user