✨ The little ASGI framework that shines. ✨
// ==UserScript== | |
// @name Keyboard Shortcut Scripts | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Run scripts with keyboard shortcuts | |
// @match *://*/* | |
// @grant none | |
// ==/UserScript== | |
(function() { |
# https://github.com/cloudflare/cloudflare-python/blob/main/api.md | |
from fastcore.script import * | |
from cloudflare import Cloudflare | |
@call_parse | |
def add_dns_record( | |
record_type: str, # Type of DNS record (CNAME or A) | |
target: str, # Target IP address or domain name | |
record: str, # Record name (without the zone) | |
zone: str, # Zone name |
# FastHTML By Example | |
An alternative introduction | |
There are lots of non-FastHTML-specific tricks and patterns involved in building web apps. The goal of this tutorial is to give an alternate introduction to FastHTML, building out example applications to show common patterns and illustrate some of the ways you can build on top of the FastHTML foundations to create your own custom web apps. A secondary goal is to have this be a useful document to add to the context of an LLM to turn it into a useful FastHTML assistant - in fact, in some of the examples we’ll see this kind of assistant in action, thanks to this custom GPT. | |
Let’s get started. | |
## FastHTML Basics |
An alternative introduction
There are lots of non-FastHTML-specific tricks and patterns involved in building web apps. The goal of this tutorial is to give an alternate introduction to FastHTML, building out example applications to show common patterns and illustrate some of the ways you can build on top of the FastHTML foundations to create your own custom web apps. A secondary goal is to have this be a useful document to add to the context of an LLM to turn it into a useful FastHTML assistant - in fact, in some of the examples we’ll see this kind of assistant in action, thanks to this custom GPT.
Let’s get started.
OAuth2 enables application developers to build applications that utilize authentication and data from the Discord API. Within Discord, there are multiple types of OAuth2 authentication. We support the authorization code grant, the implicit grant, client credentials, and some modified special-for-Discord flows for Bots and Webhooks.
The first step in implementing OAuth2 is registering a developer application and retrieving your client ID and client secret. Most people who will be implementing OAuth2 will want to find and utilize a library in the language of their choice. For those implementing OAuth2 from scratch, please see RFC 6749 for details. After you create your application with Discord, make sure that you have your client_id
and client_secret
handy. The next step is to figure out which OAuth2 flow is right for your purposes.
Application commands are native ways to interact with apps in the Discord client. There are 3 types of commands accessible in different interfaces: the chat input, a message's context menu (top-right menu or right-clicking in a message), and a user's context menu (right-clicking on a user).
CHAT_INPUT
command names and command option names must match the following regex ^[-_\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$
with the unicode flag set. If there is a lowercase variant of any letters used, you must use those. Characters with no lowercase variants and/or uncased letters are still allowed. USER
and MESSAGE
commands may be mixed case and can include spaces.
Discord apps can be installed to servers, users, or both. This guide will walk you through building a basic game integration app that is installable to both Discord users and servers.
While the tutorial will focus on supporting different installation contexts, we'll be building a basic game integration along the way with a wiki lookup with user-specific bookmarking and a server leaderboard. The app has four commands (/link
, /profile
, /leaderboard
, and /wiki
) that can be run in different installation and interaction contexts (which are concepts we'll dig into later in the tutorial).
Resources used in this guide
Overview of the tools and technologies we'll use
An Interaction is the message that your application receives when a user uses an application command or a message component.
For Slash Commands, it includes the values that the user submitted.
For User Commands and Message Commands, it includes the resolved user or message on which the action was taken.
For Message Components it includes identifying information about the component that was used. It will also include some metadata about how the interaction was triggered: the guild_id
, channel
, member
and other fields. You can find all the values in our data models below.