names = [item["name"] for item in data["organizations"]]
leaders_name = [item["leader_name"] for item in data["organizations"]]
leader_discord_id = [item["leader_discord_id"] for item in data["organizations"]]
leader_vk = [item["leader_vk"] for item in data["organizations"]]
x = {
'name': names,
'leader_name': leaders_name,
'leader_discord_id': leader_discord_id,
'leader_vk': leader_vk
}
mydb = mysql.connector.connect(
host="",
user="",
password="",
database="s424_illegals",
)
self.mycursor = self.mydb.cursor()
self.mycursor = self.mydb.cursor(buffered=True)
self.mycursor = self.mydb.cursor(dictionary=True)
curs = mydb.cursor()
curs = mydb.cursor(buffered=True)
sqlFormula = 'INSERT INTO testdb (name) VALUES (%s)'
id1 = ()
curs.execute(sqlFormula, id1)
主页
/
user-515026
Kaigaku Kibutsuji's questions
with open("data.json", "r", encoding="utf-8") as f:
d = json.load(f)
x = {
'name': d,
'leader_name': d,
'leader_discord_id': d,
'leader_vk': d
}
print(x)
我需要显示name
- 文件中的所有数据。
async def on_member_update(before, after):
a = ['Роль 1:', 'Роль 2']
if len(before.roles) < len(after.roles):
for i in after.roles:
if not i in before.roles:
if i.name in a:
role1 = client.guild.get_role(int('id'))
role1role = "\n".join([(member.mention) for member in role1.members])
embed_player.add_field(name=f'Роль1:\n', value=f'{role1role}' or 'отсутствует', inline=False)
await client.send(embed=embed_player)
删除人类角色时,机器人会抛出错误:
role1 = client.guild.get_role(int('id')) AttributeError: 'Bot' object has no attribute 'guild'
错误:找不到满足不和谐组件要求的版本(来自版本:无)错误:找不到不和谐组件的匹配分布
from discord_components import DiscordComponents, Button, ButtonStyle
@client.event
async def on_member_update(remove_roles):
await ctx.channel.send(f'Тест')```
Как сделать проверку на снятие роли участнику. После снятия роли бот отправлял сообщение в чат к примеру: **Пользователю {members.mention} снята роль {role.mentions}
К примеру есть несколько ролей на которые он будет трегерриться
vagos_zam = discord.utils.get(ctx.message.guild.roles, id = 942397028804206615)
ballas_zam = discord.utils.get(ctx.message.guild.roles, id = 942397028804206617)
aztec_zam = discord.utils.get(ctx.message.guild.roles, id = 942397028804206616)
rifa_zam = discord.utils.get(ctx.message.guild.roles, id = 942397028804206614)