mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
Output sanitisation (#1942)
* Add output sanitization defaults to context.send Add some common regex filters in redbot.core.utils.common_filters Add a wrapper for ease of use in bot.send_filtered Sanitize ModLog Case's user field (other's considered trusted as moderator input) Sanitize Usernames/Nicks in userinfo command. Santize Usernames in closing of tunnels. * Add documentation
This commit is contained in:
committed by
Toby Harradine
parent
6ebfdef025
commit
77944e195a
@@ -5,6 +5,7 @@ import io
|
||||
import sys
|
||||
import weakref
|
||||
from typing import List
|
||||
from .common_filters import filter_mass_mentions
|
||||
|
||||
_instances = weakref.WeakValueDictionary({})
|
||||
|
||||
@@ -70,10 +71,10 @@ class Tunnel(metaclass=TunnelMeta):
|
||||
self.recipient = recipient
|
||||
self.last_interaction = datetime.utcnow()
|
||||
|
||||
async def react_close(self, *, uid: int, message: str):
|
||||
async def react_close(self, *, uid: int, message: str = ""):
|
||||
send_to = self.origin if uid == self.sender.id else self.sender
|
||||
closer = next(filter(lambda x: x.id == uid, (self.sender, self.recipient)), None)
|
||||
await send_to.send(message.format(closer=closer))
|
||||
await send_to.send(filter_mass_mentions(message.format(closer=closer)))
|
||||
|
||||
@property
|
||||
def members(self):
|
||||
|
||||
Reference in New Issue
Block a user