Skip to content

Commit

Permalink
Merge pull request from GHSA-r2cf-49r7-pfj7
Browse files Browse the repository at this point in the history
* fix issue with vaiables

* upgrade version
  • Loading branch information
Dav committed May 9, 2021
1 parent 6f62a0a commit 3d54ef9
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions ticketer/ticketer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

class Ticketer(commands.Cog):
"""Ticketer"""
__version__="1.0.0"

__version__ = "1.0.1"

async def red_delete_data_for_user(self, *, requester, user_id):
# This cog stores no EUD
return

def format_help_for_context(self, ctx: commands.Context) -> str:
#Thanks Sinbad! And Trusty in whose cogs I found this.
# Thanks Sinbad! And Trusty in whose cogs I found this.
pre_processed = super().format_help_for_context(ctx)
return f"{pre_processed}\n\nVersion: {self.__version__}"

Expand Down Expand Up @@ -83,7 +84,7 @@ async def closed(self, ctx, *, category: discord.CategoryChannel):
async def message(self, ctx, *, message: str):
"""Set the message that is shown at the start of each ticket channel.\n\nUse ``{user.mention}`` to mention the person who created the ticket."""
try:
message.format(user=ctx.author)
message.format(user=SafeMember(ctx.author))
await self.config.guild(ctx.guild).message.set(message)
await ctx.send(f"The message has been set to `{message}`.")
except KeyError:
Expand Down Expand Up @@ -244,7 +245,7 @@ async def create(
category=ctx.guild.get_channel(settings["open_category"]),
topic=reason,
)
await ticketchannel.send(settings["message"].format(user=ctx.author))
await ticketchannel.send(settings["message"].format(user=SafeMember(ctx.author)))
embed = discord.Embed(
title=name,
description=reason,
Expand Down Expand Up @@ -368,3 +369,17 @@ async def _check_settings(self, ctx: commands.Context) -> bool:
return True
else:
return False


class SafeMember:
"""Thank you kenny https://github.com/kennnyshiwa/kennnyshiwa-cogs"""

def __init__(self, member: discord.Member):
self.name = member.name
self.mention = member.mention

def __str__(self):
return self.name

def __getattr__(self, name):
return ""

0 comments on commit 3d54ef9

Please sign in to comment.