Reputation: 23
it crashes with a very long error message about the token but the token isnt the problem as it worked for the past couple of hours, when it crashes i go to the console and type kill 1, it work fine after that but after a few hours it does it again. this is a bot that is written on replit.
i was wondering if there was a way to make it stay online without crashing (i am using uptimerobot already)
here is the code
#imports#######################################################################################################################imports#
import discord
from discord.ext import commands, tasks
from discord.utils import get
from replit import db
import random
from itertools import cycle
import keep_alive
import os
#starting#####################################################################################################################starting#
status = cycle(['.help', '..help'])
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix='.', intents=discord.Intents.all())
client.remove_command('help')
async def change_status():
await client.change_presence(activity=discord.Game(next(status)))
@client.event
async def on_ready():
client.loop.create_task(change_status())
print("BOT is ready, you can now leave the tab")
#member-update###########################################################################################################member-update#
@client.event
async def on_member_join(member):
print(f'{member} has joined a server.')
@client.event
async def on_member_remove(member):
print(f'{member} has left a server')
#end###############################################################################################################################end#
keep_alive.keep_alive()
client.run("TOKEN")
every time it crashes i type kill 1 in the console and it works. but it crashes again after a few hours.
i just hope that i can get it working 24/7 because the people on my server are getting annoyed
Upvotes: 0
Views: 311