def no_emotes_found_error(context, user): nsfw = utils.channel_is_nsfw(context.channel) # we use else after return because there's three of these and it's easier to read that way if not user: if nsfw: return _('No emotes have been created yet. Be the first!') else: return _( 'No emotes have been created yet, or all emotes are NSFW.') if user == context.author: if nsfw: return _('You have not created any emotes yet.') else: return _( 'You have not created any emotes yet, or all your emotes are NSFW.' ) if nsfw: # another person, sfw return _('That person has not created any emotes yet.') else: # another person, nsfw return _( 'That person has not created any emotes yet, or all their emotes are NSFW.' )
async def search(self, context, query): """Search for emotes whose name contains "query".""" processed = [ emote.with_status(linked=True) async for emote in self.db.search(query, allow_nsfw=context.channel)] if not processed: if utils.channel_is_nsfw(context.channel): return await context.send(_('No results matched your query.')) return await context.send(_('No results matched your query, or your query only found NSFW emotes.')) paginator = Pages(context, entries=processed) self.paginators.add(paginator) await self.warn_if_no_external_emojis_permission(context) await paginator.begin()