November 20, 2022

How to Build Your Own Discord Bots For Free in 5 Minutes

Think Discord is just a chat app? Think again! With these amazing tools and tutorials, you'll be able to build bots for your Discord server in 5 minutes! It doesn't matter if you've never coded before, now there's no excuse for not having a fully automated and customized Discord server.

# main.py

from flask import Flask

from threading import Thread

app = Flask('')

@app.route('/')

def home():

    return "Hello. I am alive!"

def run():

  app.run(host='0.0.0.0',port=8080)

def keep_alive():

    t = Thread(target=run)

    t.start()

Verify URL - https://discord.com/api/oauth2/authorize?client_id=[Client ID]&permissions=[Permission Integer]&scope=bot

# keep_ailve.py

import discord

import os

from keep_alive import keep_alive

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('ping'):

        await message.channel.send('pong!')

client.run(os.getenv('TOKEN'))


 


Written by Sushanth, personal technology columnist and founder of Logical Bee. You can follow him on the social web or sign up for the email newsletter for your daily dose of how-to guides and video tutorials.



0 Comments: