Home>

How to make the bot connect to a specific voice channel (by ID or whatever) and sit there 24/7?

  • Answer # 1
    import discord
    client= discord.Client()
    @client.event
    async def on_ready():
        print('We have logged in as {0.user}'.format(client))
    @client.event
    async def on_message(message):
        if message.author== client.user:
            return
        if message.content.startswith('$hello'):
            await message.channel.send('Hello!')
    client.run('your token here')
    

    https://discordpy.readthedocs.io/en/stable/quickstart.html

  • Answer # 2
    import discord
    client= discord.Client()
    @client.event
    async def on_ready():
        print('We have logged in as {0.user}'.format(client))
    @client.event
    async def on_message(message):
        if message.author== client.user:
            return
        if message.content.startswith('$hello'):
            await message.channel.send('Hello!')
    client.run('your token here')
    

    https://discordpy.readthedocs.io/en/stable/quickstart.html