Skip to content

Instantly share code, notes, and snippets.

View jaymody's full-sized avatar
🙈
ignoring bugs

Jay Mody jaymody

🙈
ignoring bugs
View GitHub Profile
@jegfish
jegfish / example_db.py
Last active March 19, 2024 03:26
Example code for connecting to and using a postgres database using discord.py and asyncpg.
# asyncpg docs: https://magicstack.github.io/asyncpg/current/
# This uses discord.py rewrite branch and .format(). If you are using the async branch of discord.py, it shouldn't matter much
# as only 'await ctx.send()' is something you should need to change. If you are using python 3.6+, you can use f strings as opposed to
# .format() for increased efficiency.
import discord
from discord.ext import commands
import asyncio
import asyncpg