how to make your programme run on your bot without having to press run all the time code example

Example 1: python discord bot moderate chat

import discord

class MyClient(discord.Client):

    async def on_ready(self):
        print('Logged on as', self.user)

    async def on_message(self, message):
        word_list = ['cheat', 'cheats', 'hack', 'hacks', 'internal', 'external', 'ddos', 'denial of service']

        # don't respond to ourselves
        if == self.user:

        messageContent = message.content
        if len(messageContent) > 0:
            for word in word_list:
                if word in messageContent:
                    await message.delete()
                    await'Do not say that!')
        messageattachments = message.attachments
        if len(messageattachments) > 0:
            for attachment in messageattachments:
                if attachment.filename.endswith(".dll"):
                    await message.delete()
                    await"No DLL's allowed!")
                elif attachment.filename.endswith('.exe'):
                    await message.delete()
                    await"No EXE's allowed!")

client = MyClient()'token here')

Example 2: bot example

#Anything commented out is optional

import discord
from discord.ext import commands

bot = commands.Bot(command_prefix='prefix here')

async def on_ready():
#   await bot.change_presence(activity=discord.Game(name="Rich Presence Here"))
    print('Logged in as: ' +
async def commandname(ctx, *, somevariable)
#If you don't need a variable, then you only need (ctx)
#	"""Command description"""
	Code goes here
	await ctx.send('Message')'yourtoken')