Skip to content

Instantly share code, notes, and snippets.

View puang59's full-sized avatar
:shipit:
loosing brain cells

Karan puang59

:shipit:
loosing brain cells
  • @vent-host
  • Chennai
  • 03:50 (UTC +05:30)
View GitHub Profile
@puang59
puang59 / example_db.py
Created June 12, 2021 07:25 — forked from jegfish/example_db.py
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