“Добро пожаловать систему” Ответ

Добро пожаловать систему

import json

#sets value in json to guild id upon the bot joining the guild
@client.event
async def on_guild_join(guild):
    #loads json file to dictionary
    with open("filename.json", "r") as f:
        guildInfo = json.load(f)

    guildInfo[guild.id] = guild.text_channels[0] #sets key to guilds id and value to top textchannel
    
    #writes dictionary to json file
    with open("filename.json", "w" as f:
        json.dump(guildInfo, f)

#allows server members to set channel for welcome messages to send to    
@client.command()
async def welcomeMessage(ctx):
    with open("filename.json", "r") as f:
        guildInfo = json.load(f)

    guildInfo[ctx.message.guild.id] = ctx.message.channel.id #sets channel to send message to as the channel the command was sent to

    with open("filename.json", "w") as f:
        json.dump(guildInfo, f)


Добро пожаловать систему

import json

#sets value in json to guild id upon the bot joining the guild
@client.event
async def on_guild_join(guild):
    #loads json file to dictionary
    with open("filename.json", "r") as f:
        guildInfo = json.load(f)

    guildInfo[guild.id] = guild.text_channels[0] #sets key to guilds id and value to top textchannel
    
    #writes dictionary to json file
    with open("filename.json", "w" as f:
        json.dump(guildInfo, f)

#allows server members to set channel for welcome messages to send to    
@client.command()
async def welcomeMessage(ctx):
    with open("filename.json", "r") as f:
        guildInfo = json.load(f)

    guildInfo[ctx.message.guild.id] = ctx.message.channel.id #sets channel to send message to as the channel the command was sent to

    with open("filename.json", "w") as f:
        json.dump(guildInfo, f)


Ответы похожие на “Добро пожаловать систему”

Вопросы похожие на “Добро пожаловать систему”

Смотреть популярные ответы по языку

Смотреть другие языки программирования