Something went wrong. Try again.
A discord bot. www.aesth.lol/byte
discord-bot bot fun discord
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253"""This is a utils cog, this is general utils that exist to be helpful.-- Ping command forked from same repo as main.py --"""
import timeimport discohookimport calendar
@discohook.command.slash('ping', description = 'Ping test the bot!')async def ping_command(interaction): created_at = interaction.created_at now = time.time() since = now - created_at
text = '\n'.join([ 'Pong! Latency: `{:.2f}ms`'.format(since * 1000), '', 'Bot started at: {}'.format(interaction.client.started_at.timestamp()), 'Interaction created at: {}'.format(created_at), 'Time right now: {}'.format(now) ])
await interaction.response.send(text)
@discohook.command.slash('timestamp', description='Get a timestamp that converts into any viewer\'s timezone.', options=[discohook.Option.string("date", "A date in MM/DD/YYYY/HH/MM format. Give it in UTC, and in 24 hr format.", required=True)])async def timestamp_command(interaction, date: str): try: timestamp = time.strptime(date, "%m/%d/%Y/%H/%M") except Exception: await interaction.response.send("Oops! Looks like an error occured...\nTry checking your inputs over again?") return timestamp = calendar.timegm(timestamp) text = '\n'.join([ 'Copy the timestamp you need below:', f'<t:{timestamp}:F>', f'<t:{timestamp}:f>', f'<t:{timestamp}:D>', f'<t:{timestamp}:d>', f'<t:{timestamp}:t>', f'<t:{timestamp}:T>', f'<t:{timestamp}:R>', f'<t:{timestamp}:s>', f'<t:{timestamp}:S>' ]) await interaction.response.send(text) @discohook.command.slash('info', description="Info on the bot")async def info_command(interaction: discohook.Interaction): embed = discohook.Embed("Byte", description="I'm a open source discord bot hosted on a serverless platform.", color=0xffffff) embed.set_footer("I'm serverless, so I might drop your commands if I take too long.") embed.add_field("Git Repo", "https://tangled.org/aesth.lol/byte") await interaction.response.send(embed=embed)