Skip to content

Instantly share code, notes, and snippets.

View TheOnlyWayUp's full-sized avatar
🎧
audiobooks for fanfiction

Dhanush R TheOnlyWayUp

🎧
audiobooks for fanfiction
View GitHub Profile
@izxxr
izxxr / README.MD
Last active March 22, 2025 11:06
Discord.py Webhook Guide (Both async and sync).

⚠️ Notice

This guide is for discord.py 1.7 version. In upcoming v2.0, Webhooks were greatly overhauled and in fact simplified a lot. They no longer require adapters. Usage of webhooks is now quite straight forward. As such, this guide is now outdated and should not be followed.

Furthermore, this guide is focused on discord.py. No support for forks are covered in this guide.

Basic Webhooks Example using Discord.py (Rewrite)

Webhooks are a great way to send messages to Discord without having a bot account. You just need a webhook URL and just do a POST request on that URL and the message will be sent to discord.

Webhooks can also be used if your bot has to send messages to a channel a lot. For example, If your bot has event logging so everytime having to fetch channel and sending can be slow so you can use some webhook magic.

@ItsDrike
ItsDrike / 1_basic_autoinit.py
Last active May 6, 2022 22:06
Python auto_init
"""
This attempts to abstarct away the standard way of using `__init__`,
the problem it tries to solve is the repetetiveness of using init purely
to store it's parameters into the instance under the exactly same name, i.e.:
class Stock:
def __init__(name, shares, price):
self.name = name
self.shares = shares
self.price = price
"""
@InterStella0
InterStella0 / HelpCommand_walkthrough_guide.md
Last active December 17, 2025 09:13
Walkthrough guide on subclassing HelpCommand
@Rafastoievsky
Rafastoievsky / cleaningdatafunctions.py
Created November 2, 2020 02:45
WhatsApp Group chat analysis: cleaning data functions
def startsWithDateAndTime(s):
pattern = '^\d{1,2}/\d{1,2}/\d{1,2}, \d{1,2}:\d{1,2}\S [AaPp][Mm] -'
result = re.match(pattern, s)
if result:
return True
return False
def FindAuthor(s):
patterns = [
'([\w]+):', # Nombre
@Soheab
Soheab / wait_for in command.md
Last active June 19, 2025 11:38
Examples for a wait_for in ext.commands.

This gist shows how to make the bot wait for a message or reaction after doing a command. This should not be copypasted.

Docs

Check the discord.py docs for a detailed explanation of how it all works internally and which kwargs it takes.

Commands

See here two commands, one waiting for any message in a channel and the other waiting for a reaction with a specific emoji.

Check

@Soheab
Soheab / API's.md
Last active February 20, 2026 23:08
See here some of the API's you can use in your discord bot or anything

Some APIs for you.

Here are some APIs you can use in your Discord bot or any other project. For any help or questions on how to use one, please contact the owner of the API and not me.

A bigger list of APIs can be found at: https://github.com/public-apis/public-apis


[TOKEN] = API requires a token to access some if not all endpoints.

@haykkh
haykkh / fastapi-discord.py
Created June 24, 2020 10:09
How to run a discord.py bot with FastAPI
import asyncio
import discord
from fastapi import FastAPI
app = FastAPI()
client = discord.Client()
# where the magic happens
# register an asyncio.create_task(client.start()) on app's startup event
@haideralipunjabi
haideralipunjabi / main.py
Created June 15, 2020 02:30
Python Script to scrape an OpenDirectory
import requests
from bs4 import BeautifulSoup as soup
import os
from progress.bar import Bar
import wget
from urllib.parse import unquote
base = "http://www.meeshdesigns.com/Western%20Fonts/"
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
@turicas
turicas / screenshot.py
Created June 6, 2020 20:34
Python script to take screenshot of a website
#!/usr/bin/env python3
# requires: pip install splinter
import argparse
import datetime
import os
import shutil
import time
from urllib.parse import urlparse
from pathlib import Path
@agentspawn
agentspawn / aiorejson.py
Created May 25, 2020 01:46
RedisJSON for aioredis
class ReJSON:
def __init__(self, _redis):
self.redis = _redis
async def set(self, key, path, jsonable, nx=False, xx=False):
"""
Set the JSON value at ``key`` under the ``path`` to ``jsonable``
``nx`` if set to True, set ``value`` only if it does not exist
``xx`` if set to True, set ``value`` only if it exists
"""