@commands.command(aliases=['uptime', 'up'])
async def status(self, ctx):
timeUp = time.time() - self.bot.startTime
hours = timeUp / 3600
minutes = (timeUp / 60) % 60
seconds = timeUp % 60
admin = self.bot.AppInfo.owner
users = 0
channel = 0
if len(self.bot.commands_used.items()):
commandsChart = sorted(self.bot.commands_used.items(), key=lambda t: t[1], reverse=False)
topCommand = commandsChart.pop()
commandsInfo = '{} (Top-Command: {} x {})'.format(sum(self.bot.commands_used.values()), topCommand[1], topCommand[0])
else:
commandsInfo = str(sum(self.bot.commands_used.values()))
for guild in self.bot.guilds:
users += len(guild.members)
channel += len(guild.channels)
embed = discord.Embed(color=ctx.me.top_role.colour)
embed.set_footer(text='UwU')
embed.set_thumbnail(url=ctx.me.avatar_url)
embed.add_field(name='Admin', value=admin, inline=False)
embed.add_field(name='Uptime', value='{0:.0f} Stunden, {1:.0f} Minuten und {2:.0f} Sekunden\n'.format(hours, minutes, seconds), inline=False)
embed.add_field(name='Beobachtete Benutzer', value=users, inline=True)
embed.add_field(name='Beobachtete Channel', value=channel, inline=True)
embed.add_field(name='Ausgeführte Commands', value=commandsInfo, inline=True)
embed.add_field(name='Bot Version', value=self.bot.botVersion, inline=True)
embed.add_field(name='Discord.py Version', value=discord.__version__, inline=True)
embed.add_field(name='Python Version', value=platform.python_version(), inline=True)
embed.add_field(name='Betriebssystem', value=f'{platform.system()} {platform.release()} {platform.version()}', inline=False)
await ctx.send('**:information_source:** Informationen über diesen Bot:', embed=embed)
I need help with this command
i get following error: [10.02.2021 16:31:10][WARN] Unknown error:[0mCommand raised an exception: AttributeError: 'Bot' object has no attribute 'startTime'
i checked all my imports.. my imports are
import discord from discord.ext import commands import datetime import json import aiohttp import random import ast from pymongo import MongoClient from discord.utils import get from pytz import timezone import os import math import itertools from discord.ext.commands import CommandNotFound, MissingPermissions, MessageNotFound import asyncio
self.bot.startTime
replace withstart_time
– Ajay