def raw(self, ctx, *, name: TagName(lower=True)):
"""Gets the raw content of the tag.
This is with markdown escaped. Useful for editing.
"""
try:
tag = await self.get_tag(ctx.guild.id, name, connection=ctx.db)
except RuntimeError as e:
return await ctx.send(e)
transformations = {
re.escape(c): '\\' + c
for c in ('*', '`', '_', '~', '\\', '<')
}
def replace(obj):
return transformations.get(re.escape(obj.group(0)), '')
pattern = re.compile('|'.join(transformations.keys()))
await ctx.send(pattern.sub(replace, tag['content']))
评论列表
文章目录