Discord.py bot from replit to local

I used Code a Discord Bot with Python - Host for Free in the Cloud - YouTube from Beau Carnes and I was wondering how to host it locally.

Hey nickmg,

welcome to the FreeCodeCamp community.

judging by the example that they have on their site:

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')

You should be able to put the code into a python file e.g. “my_bot.py” and run it locally.

best
Dennis

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.