Merge pull request #72 from classabbyamp/ping-surprise

PONG!
This commit is contained in:
Abigail Gold 2019-11-09 02:21:44 -05:00 committed by GitHub
commit 118e3f5d90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,7 @@ General Public License, version 2.
from datetime import datetime from datetime import datetime
import re import re
from collections import OrderedDict from collections import OrderedDict
import random
import discord import discord
import discord.ext.commands as commands import discord.ext.commands as commands
@ -38,13 +39,16 @@ class BaseCog(commands.Cog):
@commands.command(name="ping") @commands.command(name="ping")
async def _ping(self, ctx: commands.Context): async def _ping(self, ctx: commands.Context):
"""Show the current latency to the discord endpoint.""" """Show the current latency to the discord endpoint."""
content = ''
if random.random() < 0.05:
content = f'<@{ctx.message.author.id}>'
embed = discord.Embed(title="**Pong!**", embed = discord.Embed(title="**Pong!**",
description=f'Current ping is {self.bot.latency*1000:.1f} ms', description=f'Current ping is {self.bot.latency*1000:.1f} ms',
colour=self.gs.colours.neutral, colour=self.gs.colours.neutral,
timestamp=datetime.utcnow()) timestamp=datetime.utcnow())
embed.set_footer(text=ctx.author.name, embed.set_footer(text=ctx.author.name,
icon_url=str(ctx.author.avatar_url)) icon_url=str(ctx.author.avatar_url))
await ctx.send(embed=embed) await ctx.send(content=content, embed=embed)
@commands.command(name="changelog", aliases=["clog"]) @commands.command(name="changelog", aliases=["clog"])
async def _changelog(self, ctx: commands.Context): async def _changelog(self, ctx: commands.Context):