Skip to content

Instantly share code, notes, and snippets.

from __future__ import annotations
import datetime
from typing import Any, Literal, Self, overload
import discord
type ValidMediaType = (
str
| Media
| discord.MediaGalleryItem
@pythonmcpi
pythonmcpi / example.py
Last active September 16, 2025 17:47
A quick example of using all the new v2 components with discord.py
# To run this example directly, you'll need to have an image file named `discordpy_logo.png` in the same directory.
import discord
from discord import app_commands
import io
DISCORDPY_LOGO_URL = "https://cdn.discordapp.com/icons/336642139381301249/3aa641b21acded468308a37eef43d7b3.png?size=256"
class ExampleButton(discord.ui.Button):
@amazingakai
amazingakai / bot.py
Last active January 23, 2025 11:35
Discord.py button roles example.
from __future__ import annotations
import re
from typing import Optional
import discord
from discord.ext import commands
# Role IDs to labels mapping.
# role_id: label
@eylenburg
eylenburg / msoffice_in_linux.md
Last active January 1, 2026 07:25
Installing Microsoft Office in Linux

Step by step guide: How to install Microsoft Office in any Linux distribution

There are multiple options how to install MS Office on Linux.

VM-based - Integrate Windows apps running in a Windows virtual machine as native-looking in Linux

  1. LinOffice - Microsoft Office Launcher for Linux, my own fork of Winapps which is focused on only running Microsoft Office, with some Office-specific improvements over Winapps and a fully automated setup. Eventually I would like to create a GUI for it. Decribed below
  2. Winapps, based on KVM, QEMU, Docker/Podman and FreeRDP. Still actively maintained (getting Github commits). Decribed below
  3. Cassowary, based on KVM, QEMU, libvirt/virt-manager, and FreeRDP. Last release in Feb 2022 and seems to be abandoned.
DATEADD(
DATETIME_PARSE(
MONTH(DATEADD({Your Date Field},1,'month')) & "/1/" & YEAR(DATEADD({Your Date Field},1,'month')),
'M/D/YYYY'),
-1,'day')
@LeoCx1000
LeoCx1000 / .README.md
Last active May 20, 2025 19:22
Mentionable CommandTree implementation to allow mentioning slash commands in discord.py

discord.py MentionableTree implementation

My implementation of a CommandTree subclass which allows for finding a mention for a given app command.

How to use?

Just copy the entire third file into a new python file of your project, and import MentionableTree from it.

You can also use git clone [gist link] folder_name and then from folder_name import MentionableTree

@tboerger
tboerger / README.md
Created November 14, 2022 13:43
Hack The Box: Starting Point Tier 0

Meow

Questionnaire

What does the acronym VM stand for?
Virtual Machine
@Soheab
Soheab / complete..md
Last active July 15, 2024 05:30
See here a custom check for all types of commands that can be used to check if user has any permissions you pass

See here the "complete" check

"complete" as in it supports app and text commands and has some comments explaining the code. As you may have noticed, there are multiple files in this gist:

Text Cmmands Only Here

Complete

See here the complete check with support for app and text commands:

from typing import Any, Self, overload
import asyncio
import discord
HasChildren = (
discord.ui.Container
| discord.ui.ActionRow
@imptype
imptype / messagemaker.py
Last active March 31, 2025 16:32
A better embed maker/embed builder for discord.py
"""
The messagemaker command!
Supports:
- Editing message content
- Add, edit, remove, clear embeds: title, desc, timestamp, fields etc. - everything to customize an embed.
-- Exporting and Importing exclusively for the embed
- Importing JSON: from modal text input, from mystbin link, from existing message
- Exporting to JSON, as a message or uploaded as file and mystbin link if < 2000 chars
- Sending to: a channel, a webhook, edit existing message