This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import json | |
import random | |
from typing import Callable, Tuple | |
import discord | |
from discord.ext import commands | |
import lib.checks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import discord | |
from discord.ext import commands | |
import re | |
import asyncio | |
import lib.checks | |
from discord.ext.commands import BucketType, Cooldown, CooldownMapping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import discord | |
from discord.ext import commands | |
class EntranceGate(commands.Cog): | |
def __init__(self, bot: commands.Bot): | |
self.bot = bot | |
self.ROLE = 694105778339971112 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import main | |
app = main.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# asking for a yes/no user confirmation for deleting something | |
# NOTE: if the user cancels, this function returns None, *NOT* the user's response | |
await ctx.send("Type yes to delete the file and no to cancel") | |
confirmation = _input(ctx, str, cancel_str="no", ch=lambda x: x.lower() in ("yes", "no"), | |
err="Input yes or no", del_err=60, del_response=True) | |
# this will return None or "yes" | |
if not confirmation: | |
# the user canceled, so _input returned None | |
# do stuff here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ctx - required - a commands.Context of the commands | |
# typ - required - the type you want to return | |
# cancel_str - the string that a user will type to cancel | |
# ch - a function/lambda that is checked for validity | |
# err - error string | |
# del_error - the time to wait before deleting the error message | |
# del_response - delete the user's response | |
# return_author - return (result, author) otherwise just return result | |
# check_author - whether to wait for an author matching ctx.author | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import json | |
import socket | |
from typing import Dict | |
import discord | |
from discord.ext import commands, tasks | |
from libs.mcrcon import MinecraftClient |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def _input(self, ctx, typ: type, cancel_str: str = "cancel", ch: Callable = None, err=None, check_author=True, | |
return_author=False, del_error=60, del_response=False): | |
def check(m): | |
return ((m.author == ctx.author and m.channel == ctx.channel) or not check_author) and not m.author.bot | |
while True: | |
try: | |
inp: discord.Message = await self.bot.wait_for('message', check=check, timeout=60.0) | |
if del_response: | |
await inp.delete() |