Skip to content

Instantly share code, notes, and snippets.

View FrostiiWeeb's full-sized avatar

Alex Hutz FrostiiWeeb

View GitHub Profile
@FrostiiWeeb
FrostiiWeeb / how_to_use.py
Last active March 4, 2022 20:43
A rough example of discord.py modals. The code was improved from the original gist by Jeyy.
from modal import Modal, Style
from discord.ext import commands
import discord
class View(discord.ui.View):
def __init__(self, context: commands.Context):
self.context = context
super().__init__(timeout=180)
@discord.ui.button(label="test")
@FrostiiWeeb
FrostiiWeeb / modal_implementation_example.py
Created March 4, 2022 20:32 — forked from JeyyGit/modal_implementation_example.py
Rough implementation of modal in discord.py 2
import discord, secrets
class TextInput:
"""for storing our text input data"""
def __init__(self, payload):
self.type = payload['type']
self.custom_id = payload['custom_id']
self.style = payload['style']
self.label = payload['label']
self.min_length = payload.get('min_length')
@FrostiiWeeb
FrostiiWeeb / cache.py
Created June 27, 2021 08:37
A example for a simple cache system.
class CacheError(Exception):
def __init__(self, message : str):
super().__init__(message)
class CacheOutput:
def __init__(self, cache_system):
self.cache = cache_system
def replace(self, result_name, result_output):
self.cache._properties[result_name] = result_output