Skip to content

Instantly share code, notes, and snippets.

View Soheab's full-sized avatar
👀

Soheab Soheab

👀
View GitHub Profile
@Soheab
Soheab / threads.md
Last active December 20, 2025 15:58
See here everything about threads and how to manage them using discord.py

Basics

  • (Forum) posts are threads in forum channels.
  • Threads can be created per message or per channel.
  • Only channel threads can be private.
  • For message and forum threads, the thread's ID matches the starter message's ID.
  • You can lock threads so only users with the right permissions can send messages.
  • Threads can be archived, which removes them from the channel list. This also happens automatically after a period of inactivity.
@Soheab
Soheab / ideas.md
Last active December 28, 2025 14:20
Ideas to create commands for a Discord bot, but without the privileged message content intent.
from __future__ import annotations
import datetime
from typing import Any, Literal, Self, overload
import discord
type ValidMediaType = (
str
| Media
| discord.MediaGalleryItem
@Soheab
Soheab / 0-how_to_use.md
Last active December 28, 2025 13:17
A simple paginator with three buttons.

Components V2

Looking to paginate with v2 components like a Container? Go to https://gist.github.com/Soheab/891c39d7294b1bdbadc7ecf35ce51cc5

Usage

  1. Copypaste the contents above into a file like utils/paginator.py
  2. Import ButtonPaginator and subclass it or use it directly anywhere.

Options

ButtonPaginator has a couple of arguments.

@Soheab
Soheab / self_bot.md
Last active November 15, 2024 20:58
Read here how "self.bot" works in a discord.py cog. For a tag called `?tag self.bot` on the dpy server.

What is self.bot and how does it work?

TLDR: it's a custom attribute which you define.

self = class instance
bot = attribute that's usually assigned to the bot instance given in an extension's setup function.

Basically:

class MyCog(Cog):
    # this function is called when we do MyCog()
# for testing:
# import collections
# emoji = collections.namedtuple("emo", ["animated"])(False)
emoji = ... # some (Partial)Emoji object
guild = ... # some Guild object
emojis = guild.emojis
total = len(guild.emojis)
limit = guild.emoji_limit
animated = sum(1 for e in emojis if e.animated)
@Soheab
Soheab / markdown.md
Last active August 10, 2023 21:51
See here the progress of the discord.py library after discontinuation.

The hyperlinks are either links to a gist or discord message in the discord.py server

  • Danny reworks async stuff, breaking changes for all!
@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