async def on_message(self, message):
if ctx.channel.id == channel:
u_r = await bot.wait_for('message', check=lambda message: message.author == ctx.author) # Проверка сообщения
msg_channel = u_r.content
print(msg_channel)
else:
return
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix=',', intents=discord.Intents.all())
bot_ver = '1.0.0'
@bot.event
async def on_ready():
print(f"Бот успешно включен! Версия: {bot_ver}")
# Авто-выдача роли.
@bot.event
async def on_member_join(member):
role = member.guild.get_role(role_id=941019881221009498)
await member.add_roles(role)
token = '(ВСТАВИТЬ ТОКЕН!)'
bot.run(token)
with open('file.json', 'r') as suns:
s_data = suns.read()
s_d = json.loads(s_data)
user_suu = s_d[*]['balance']
@bot.command()
@commands.has_permissions(administrator = True)
async def news(ctx, arg=None, arg1=None):
channel = bot.get_channel(980500039820533790)
embed = discord.Embed(
title = f'Новость {arg}',
description = f'Описание: {arg1}',
color = discord.Colour.green()
)
await channel.send(embed=embed)
embed2 = discord.Embed(
title = 'Успешно создана новость!',
description = 'Новость была опубликована',
color = discord.Colour.green(),
)
await ctx.send(embed=embed2)
user_discord_id = ctx.author.id
user_class = 1
normal_AO_ver = 1.0
user_standart_balance = 1
normal_position = 'normal'
password = await bot.wait_for('message', check=lambda message: message.author == ctx.author)
user_password = password.content
nickname = await bot.wait_for('message', check=lambda message: message.author == ctx.author)
user_nickname = nickname.content
with open('users.json','r') as jfr:
jf_file = json.loads(jfr)
jf_file.append({
user_nickname: user_id, user_password, normal_position, user_discord_id, 0, normal_AO_ver, user_standart_balance
})
with open('users.json','w') as jf:
json.dump(jf_file, jf, indent=4)
user_nickname: user_id, user_password, normal_position, user_discord_id, 0, normal_AO_ver, user_standart_balance
^
SyntaxError: invalid syntax
data = {"username": user_nickname, "password": user_password, "id": user_id, 'position': normal_position}
with open('users.json') as f:
json.load(f)
users_list = []
users_list.append(data)
with open('users.json') as f:
string = json.dumps(user_list)
data
. Если я не так понял, подкорректируйте