admin_id = 1234567890 # The Discord ID of the bot owner or admin @bot.command() async def bot_time(ctx, time_period: str): if ctx.author.id != admin_id: await ctx.send("You don't have permission to change the bot's uptime.") return if time_period == "24/7": await ctx.send("Bot will stay online 24/7.") # Continuous uptime logic can be handled here if desired elif time_period.endswith('m'): time = int(time_period[:-1]) await ctx.send(f"Bot will stay online for {time} minutes.") await asyncio.sleep(time * 60) await ctx.send("Bot has gone offline after the set time.") await bot.close() elif time_period.endswith('h'): time = int(time_period[:-1]) await ctx.send(f"Bot will stay online for {time} hours.") await asyncio.sleep(time * 3600) await ctx.send("Bot has gone offline after the set time.") await bot.close() elif time_period.endswith('d'): time = int(time_period[:-1]) await ctx.send(f"Bot will stay online for {time} days.") await asyncio.sleep(time * 86400) await ctx.send("Bot has gone offline after the set time.") await bot.close() else: await ctx.send("Invalid time format. Use m, h, or d.")