From 67aa084f1e41719361e35da06678d8d21a0f7872 Mon Sep 17 00:00:00 2001 From: norohind <60548839+norohind@users.noreply.github.com> Date: Wed, 16 Mar 2022 22:05:21 +0300 Subject: [PATCH] Add information cog --- cogs/BotInformation.py | 36 ++++++++++++++++++++++++++++++++++++ cogs/TTSSettings.py | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 cogs/BotInformation.py diff --git a/cogs/BotInformation.py b/cogs/BotInformation.py new file mode 100644 index 0000000..0c02086 --- /dev/null +++ b/cogs/BotInformation.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +from discord.ext import commands +from discord.ext.commands import Context +import datetime +import time + + +class BotInformation(commands.Cog): + def __init__(self, bot: commands.Bot): + self.bot: commands.Bot = bot + self.start_time: float = time.time() + + @commands.command('info') + async def get_info(self, ctx: Context): + info = f""" +Text-To-Speech bot, based on Silero TTS model () +License: `GNU GENERAL PUBLIC LICENSE Version 3` +Author discord: `a31#6403` +Author email: `a31@demb.design` +Source code on github: +Source code on gitea's a31 instance: +Invite link: https://discord.com/oauth2/authorize?client_id={self.bot.user.id}&scope=bot%20applications.commands + """ + + await ctx.send(info) + + @commands.command('uptime') + async def uptime(self, ctx: Context): + uptime = time.time() - self.start_time + uptime_str = datetime.timedelta(seconds=int(uptime)) + await ctx.send(f"Application is up for {str(uptime_str)}") + + +async def setup(bot): + await bot.add_cog(BotInformation(bot)) diff --git a/cogs/TTSSettings.py b/cogs/TTSSettings.py index d195fa0..4e9ca4b 100644 --- a/cogs/TTSSettings.py +++ b/cogs/TTSSettings.py @@ -99,4 +99,4 @@ class TTSSettings(commands.Cog): async def setup(bot): - await bot.add_cog(TTSSettings(bot)) \ No newline at end of file + await bot.add_cog(TTSSettings(bot))