【发布时间】:2020-10-31 03:36:14
【问题描述】:
有这个不和谐的机器人。我不想为我的服务器创建。但我使用 psycopg2 是因为我不想用它来创建项目创意列表。我收到了这个错误psycopg2.ProgrammingError: can't adapt type 'set' 这是我的代码:
import psycopg2
import os
from discord.ext import commands
import discord
conn = psycopg2.connect(
host="ec2-3-216-92-193.compute-1.amazonaws.com",
database="d1vpende403347",
user="hnzgmwsoiogmmt",
password="86bfca0c982e04ae0ca6e6f4d1f4fb03ca5f4f4cb9a911672fa993a300e7ea0e",
port=5432)
bot=discord.Client()
bot=commands.Bot(command_prefix="!")
cursor=conn.cursor()
@bot.command()
async def rules(ctx):
await ctx.send("1. To enter our server, you have of course to learn python and some libraries, for example: 'discord.py', 'django'.\n2. No insults or bad words.\n3.Enjoy it.")
@bot.command()
async def new(ctx, author:discord.Member, project):
name=author.display_name
await ctx.send(f"There is your entry: The author: {name} , project: {project}")
cursor.execute(f"INSERT INTO ideas(author,project) VALUES(%s,%s)",({name},{project}))
await ctx.send("The entry was succesfully added""")
print("And There it is, you're connected")
TOKEN=os.environ.get("DISCORD_BOT_SECRET")
bot.run(TOKEN)
cursor.close()
conn.close()
感谢回复
【问题讨论】:
-
这能回答你的问题吗? ProgrammingError: can't adapt type 'set'
-
不,我找到了答案