@@ -13,9 +13,19 @@ def split_quoter(quoter: str):
1313 return quoter [0 ], quoter [1 ] if len (quoter ) > 1 else None
1414
1515
16+ async def verify_quoter (ctx , quoter , quoter_group ):
17+ if quoter_group :
18+ if '<@' in quoter_group :
19+ await ctx .reply ('You can only mention a user as a quoter, but not a quoter group.' )
20+ raise commands .errors .CheckFailure
21+ if '\n ' in quoter or '\n ' in quoter_group :
22+ await ctx .reply ('Quoter must be single line!' )
23+ raise commands .errors .CheckFailure
24+
25+
1626class Bottas (commands .Cog ):
1727 """Storing messages.
18- Version 3.2"""
28+ Version 3.2.1 """
1929
2030 def __init__ (self , bot ):
2131 self .bot = bot
@@ -66,8 +76,6 @@ async def quote_add(self, ctx: commands.Context, *, quote):
6676 """d.quote a <quote>
6777 quote: The new quote to be added
6878 """
69- # Quote message validation
70- await missile .check_arg (ctx , quote )
7179 # Check if a quote with the same content already exists in the database
7280 rowid = await self .bot .sql .quote_msg_exists (self .bot .db , msg = quote )
7381 if rowid :
@@ -76,9 +84,8 @@ async def quote_add(self, ctx: commands.Context, *, quote):
7684 # Asks for the quoter who said the quote
7785 quoter = await self .bot .ask_msg (ctx , 'Quoter?' )
7886 if quoter :
79- # Quote message validation
80- await missile .check_arg (ctx , quoter )
8187 quoter , quoter_group = split_quoter (quoter )
88+ await verify_quoter (ctx , quoter , quoter_group ) # Quoter validation
8289 # Determines the ROWID to be used for inserting the quote
8390 rowid = await self .bot .sql .get_next_row_id (self .bot .db )
8491 if rowid : # Use ROWID from QuoteRowID if available. These IDs exist when a quote was deleted
@@ -136,14 +143,12 @@ async def edit(self, ctx: commands.Context, index: int):
136143 if quote and (quote [2 ] == ctx .author .id or ctx .author .id == self .bot .owner_id ):
137144 quote = Quote (index , * quote )
138145 content = await self .bot .ask_msg (ctx , 'Enter the new quote: (wait 10 seconds if it is the same)' )
139- if content : # Quote message validation
140- await missile .check_arg (ctx , content )
141- else :
146+ if not content :
142147 content = quote .msg
143148 quoter = await self .bot .ask_msg (ctx , "Enter new quoter: (wait 10 seconds if it is the same)" )
144- if quoter : # Quoter validation
145- await missile .check_arg (ctx , quoter )
149+ if quoter :
146150 quoter , quoter_group = split_quoter (quoter )
151+ await verify_quoter (ctx , quoter , quoter_group ) # Quoter validation
147152 else :
148153 quoter = quote .quoter
149154 quoter_group = quote .quoter_group
0 commit comments