Skip to content

Instantly share code, notes, and snippets.

@BruceCodesGithub
Created October 13, 2021 11:54
Show Gist options
  • Save BruceCodesGithub/ef9d4830cddf1339e2ce53c07d80a901 to your computer and use it in GitHub Desktop.
Save BruceCodesGithub/ef9d4830cddf1339e2ce53c07d80a901 to your computer and use it in GitHub Desktop.
AIOSQLITE with Discord Bots
import discord
from discord.ext import commands
import aiosqlite, asyncio
async def setup():
bot.db = await aiosqlite.connect("storage/bot.db")
await bot.db.execute("CREATE TABLE IF NOT EXISTS mytable (column1, column2)")
await bot.db.commit()
bot = commands.Bot(
command_prefix="!",
)
asyncio.get_event_loop().run_until_complete(setup())
bot.run("TOKEN")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment