Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.

Commit 5a737cd

Browse files
committed
250330 Stable data usage
1 parent 93111b3 commit 5a737cd

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

cogs/reference.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ def not_exact_details(details : list[models.DetailByField]):
124124
content += 'Found ' + temp
125125
return content
126126

127-
async def send_reference(self, interaction : Interaction, references : list[models.ReferenceInfo], **kwargs):
127+
async def send_reference(self, interaction : Interaction, reference : list[models.ReferenceInfo], **kwargs):
128128
try:
129129
fields = {k: v for k, v in kwargs.items() if v is not None}
130-
result = fuzzy.search_references(fields, references, score_cutoff=60)
130+
result = fuzzy.search_references(fields, reference, score_cutoff=60)
131131

132132
references = result['references']
133133
details = result['detail']
@@ -170,9 +170,9 @@ async def carhunt_autocompletion(
170170
) -> List[app_commands.Choice[str]]:
171171

172172
if not current:
173-
result: list[str] = [a.car for a in self.carhunt_reference]
173+
result: list[str] = [a.car for a in self.carhunt_reference.copy()]
174174
else:
175-
result: list[str] = fuzzy.extract_group(current, 'car', self.carhunt_reference)
175+
result: list[str] = fuzzy.extract_group(current, 'car', self.carhunt_reference.copy())
176176

177177
return [
178178
app_commands.Choice(name=choice, value=choice) for choice in result
@@ -191,7 +191,7 @@ async def carhunt_autocompletion(
191191
@app_commands.autocomplete(car=carhunt_autocompletion)
192192
async def carhunt(self, interaction : Interaction, car : str):
193193
await interaction.response.defer(thinking=True)
194-
await self.send_reference(interaction, self.carhunt_reference, car=car) # reference params
194+
await self.send_reference(interaction, self.carhunt_reference.copy(), car=car) # reference params
195195

196196
async def clash_autocompletion(
197197
self,
@@ -200,9 +200,9 @@ async def clash_autocompletion(
200200
) -> List[app_commands.Choice[str]]:
201201

202202
if not current:
203-
result: list[str] = list(set([a.track for a in self.clash_reference]))
203+
result: list[str] = list(set([a.track for a in self.clash_reference.copy()]))
204204
else:
205-
result: list[str] = fuzzy.extract_group(current, 'track', self.clash_reference)
205+
result: list[str] = fuzzy.extract_group(current, 'track', self.clash_reference.copy())
206206

207207
return [
208208
app_commands.Choice(name=choice, value=choice)
@@ -226,7 +226,7 @@ async def clash(
226226
track : str,
227227
):
228228
await interaction.response.defer(thinking=True)
229-
await self.send_reference(interaction, self.clash_reference, track=track)
229+
await self.send_reference(interaction, self.clash_reference.copy(), track=track)
230230

231231
@app_commands.command(
232232
description='Let you know elite cup reference!',
@@ -244,7 +244,7 @@ async def elite(
244244
cls : Literal["S", "A", "B", "C"],
245245
):
246246
await interaction.response.defer(thinking=True)
247-
await self.send_reference(interaction, self.elite_reference, cls=cls)
247+
await self.send_reference(interaction, self.elite_reference.copy(), cls=cls)
248248

249249
async def weekly_autocompletion(
250250
self,
@@ -253,9 +253,9 @@ async def weekly_autocompletion(
253253
) -> List[app_commands.Choice[str]]:
254254

255255
if not current:
256-
matches: list[str] = list(set([a.track for a in self.weekly_reference]))
256+
matches: list[str] = list(set([a.track for a in self.weekly_reference.copy()]))
257257
else:
258-
matches: list[str] = fuzzy.extract_group(current, 'track', self.weekly_reference)
258+
matches: list[str] = fuzzy.extract_group(current, 'track', self.weekly_reference.copy())
259259

260260
return [
261261
app_commands.Choice(name=choice, value=choice)
@@ -279,7 +279,7 @@ async def weekly(
279279
track : str,
280280
):
281281
await interaction.response.defer(thinking=True)
282-
await self.send_reference(interaction, self.weekly_reference, track=track)
282+
await self.send_reference(interaction, self.weekly_reference.copy(), track=track)
283283

284284

285285
async def setup(app : Al9oo):

0 commit comments

Comments
 (0)