Skip to content

Getting Issues when I am implementing samp-query with discord.py. #1

@NafizRohan

Description

@NafizRohan
async def Update_Channel_Status(): 
    channel = await client.fetch_channel(config.StatusChannel)
    try:
        game = Client(ip= config.IP, port= config.PORT)
        samp = await game.connect() 
    except Exception as e:
        if channel.name == "Players: 0(offline)":
            return
        else:
            await channel.edit(name="Players: 0(offline)")
        print(e)
    else:
        members = info.players
        tempname =f"Players: {members}" 
        if channel.name == tempname:
            return
        else:
            await channel.edit(name=f"Players: {members}")
    return

@client.event
async def on_ready():
    Update_Channel_Status.start()
    return

client.run(config.TOKEN)

Error:RuntimeError: must be called from async context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions