Answer the question
In order to leave comments, you need to log in
How to connect a database to a discord bot, and how to use it (Host HEROKU) - discord.py PostgreSQL?
Hello!
I have this code:
import discord
from discord.ext import commands
import os
import asyncpg, asyncio
PREFIX=('.')
class prefix(commands.Cog):
def __init__(self,bot):
self.bot = bot
@commands.Cog.listener()
async def on_guild_join(self, guild):
pass
@commands.Cog.listener()
async def on_guild_remove(self,ctx):
pass
@commands.command()
@commands.has_permissions(administrator=True)
async def prefix(self, ctx, prefix):
pass
def setup(bot):
bot.add_cog(prefix(bot))
url = os.environ.get('db')
Answer the question
In order to leave comments, you need to log in
Have you even read the setup documentation?
after these settings, install postgresql and pgAdmin (they are included, it will be unnecessary to climb different sites).
start the pgAdmin server, connect to the Heroku databases, search for your own among the list of strangers and work with it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question