def box_search(self, ctx, *, query: commands.clean_content):
"""Searches for a tag in the tag box.
The query must be at least 3 characters long.
"""
if len(query) < 3:
return await ctx.send('Query must be 3 characters or longer.')
sql = "SELECT name FROM tags WHERE name % $1 AND location_id IS NULL LIMIT 100;"
data = await ctx.db.fetch(sql, query)
if len(data) == 0:
return await ctx.send('No tags found.')
await ctx.release()
data = [r[0] for r in data]
data.sort()
try:
p = Pages(ctx, entries=data, per_page=20)
await p.paginate()
except Exception as e:
await ctx.send(e)
评论列表
文章目录