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

async def on_ready():
    print('We have logged in as {0.user}'.format(client))

async def on_message(message):
    if message.author == client.user:

    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.


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