|
41 | 41 |
|
42 | 42 |
|
43 | 43 | class Modmail(commands.Bot):
|
| 44 | + |
| 45 | + version = '1.1.4' |
| 46 | + |
44 | 47 | def __init__(self):
|
45 | 48 | super().__init__(command_prefix=self.get_pre)
|
46 |
| - self.uptime = datetime.datetime.utcnow() |
| 49 | + self.start_time = datetime.datetime.utcnow() |
47 | 50 | self._add_commands()
|
48 | 51 |
|
49 | 52 | def _add_commands(self):
|
@@ -76,7 +79,8 @@ def token(self):
|
76 | 79 | @staticmethod
|
77 | 80 | async def get_pre(bot, message):
|
78 | 81 | '''Returns the prefix.'''
|
79 |
| - return bot.config.get('PREFIX') or 'm.' |
| 82 | + p = bot.config.get('PREFIX') or 'm.' |
| 83 | + return [p, bot.user.mention+' '] |
80 | 84 |
|
81 | 85 | async def on_connect(self):
|
82 | 86 | print('---------------')
|
@@ -199,15 +203,48 @@ def help_embed(self, prefix):
|
199 | 203 | em.add_field(name='Custom Mentions', value=mention)
|
200 | 204 | em.add_field(name='Warning', value=warn)
|
201 | 205 | em.add_field(name='Github', value='https://github.com/kyb3r/modmail')
|
202 |
| - em.set_footer(text='Modmail v1.1.3 | Star the repository to unlock hidden features! /s') |
| 206 | + em.set_footer(text=f'Modmail v{self.version} | Star the repository to unlock hidden features! /s') |
203 | 207 |
|
204 | 208 | return em
|
205 | 209 |
|
| 210 | + @property |
| 211 | + def uptime(self): |
| 212 | + now = datetime.datetime.utcnow() |
| 213 | + delta = now - self.start_time |
| 214 | + hours, remainder = divmod(int(delta.total_seconds()), 3600) |
| 215 | + minutes, seconds = divmod(remainder, 60) |
| 216 | + days, hours = divmod(hours, 24) |
| 217 | + |
| 218 | + fmt = '{h}h {m}m {s}s' |
| 219 | + if days: |
| 220 | + fmt = '{d}d ' + fmt |
| 221 | + |
| 222 | + return fmt.format(d=days, h=hours, m=minutes, s=seconds) |
| 223 | + |
206 | 224 | @commands.command()
|
207 | 225 | async def help(self, ctx):
|
208 | 226 | prefix = self.config.get('PREFIX', 'm.')
|
209 | 227 | em = self.help_embed(prefix)
|
210 | 228 | await ctx.send(embed=em)
|
| 229 | + |
| 230 | + @commands.command() |
| 231 | + async def about(self, ctx): |
| 232 | + em = discord.Embed(color=discord.Color.green()) |
| 233 | + em.set_author(name='Mod Mail - Information', icon_url=self.user.avatar_url) |
| 234 | + em.set_thumbnail(url=self.user.avatar_url) |
| 235 | + |
| 236 | + em.description = 'This is an open source discord bot made by kyb3r and '\ |
| 237 | + 'improved upon suggestions by the users! This bot serves as a means for members to '\ |
| 238 | + 'easily communicate with server leadership in an organised manner.' |
| 239 | + |
| 240 | + em.add_field(name='Uptime', value=self.uptime) |
| 241 | + em.add_field(name='Latency', value=f'{self.latency*1000:.2f} ms') |
| 242 | + em.add_field(name='Version', value=f'`v{self.version}`') |
| 243 | + em.add_field(name='Author', value='[`kyb3r`](https://github.com/kyb3r)') |
| 244 | + em.add_field(name='Github', value='https://github.com/kyb3r/modmail') |
| 245 | + em.set_footer(text=f'Bot ID: {self.user.id}') |
| 246 | + |
| 247 | + await ctx.send(embed=em) |
211 | 248 |
|
212 | 249 | @commands.command()
|
213 | 250 | @commands.has_permissions(administrator=True)
|
|
0 commit comments