mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
* Create converters.py * Update trivia.py * Create checks.py * Update checks.py * Update checks.py * Update trivia.py * Update checks.py * Update checks.py * Update trivia.py * Update bank.py * Update economy.py * Update trivia.py * Update checks.py * Update checks.py * Update __init__.py
26 lines
772 B
Python
26 lines
772 B
Python
from redbot.core import commands
|
|
from redbot.core.i18n import Translator
|
|
|
|
__all__ = ("trivia_stop_check",)
|
|
|
|
_ = Translator("Trivia", __file__)
|
|
|
|
|
|
def trivia_stop_check():
|
|
async def predicate(ctx: commands.GuildContext) -> bool:
|
|
session = ctx.cog._get_trivia_session(ctx.channel)
|
|
if session is None:
|
|
raise commands.CheckFailure(_("There is no ongoing trivia session in this channel."))
|
|
|
|
author = ctx.author
|
|
auth_checks = (
|
|
await ctx.bot.is_owner(author),
|
|
await ctx.bot.is_mod(author),
|
|
await ctx.bot.is_admin(author),
|
|
author == ctx.guild.owner,
|
|
author == session.ctx.author,
|
|
)
|
|
return any(auth_checks)
|
|
|
|
return commands.permissions_check(predicate)
|