Safety features
This commit is contained in:
parent
444957dddf
commit
6b0c044c40
2 changed files with 41 additions and 0 deletions
|
@ -25,5 +25,11 @@ class Inspirobot(commands.Cog):
|
||||||
embed.set_image(url=image)
|
embed.set_image(url=image)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
@commands.command(name="test", dscription="Who cares tbh")
|
||||||
|
@commands.cooldown(1, 3)
|
||||||
|
async def test(self, ctx):
|
||||||
|
await self.client.get_channel(621378664977793024).send("Test")
|
||||||
|
await ctx.send(self.client.name)
|
||||||
|
|
||||||
def setup(client : discord.Client):
|
def setup(client : discord.Client):
|
||||||
client.add_cog(Inspirobot(client))
|
client.add_cog(Inspirobot(client))
|
||||||
|
|
35
cogs/fun/safety.py
Normal file
35
cogs/fun/safety.py
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import discord
|
||||||
|
from discord.ext import commands
|
||||||
|
from util import embed, logging
|
||||||
|
import time
|
||||||
|
|
||||||
|
class Safety(commands.Cog):
|
||||||
|
def __init__(self, client):
|
||||||
|
self.client = client
|
||||||
|
self.msg_buffer = [".", ".", ".", ".", ".", "."]
|
||||||
|
self.ping = "<@&380535423233032193>"
|
||||||
|
self.channel = 439466964625391637
|
||||||
|
self.last_action = 0
|
||||||
|
|
||||||
|
@commands.Cog.listener()
|
||||||
|
async def on_message(self, message):
|
||||||
|
if message.channel.id != self.channel:
|
||||||
|
return
|
||||||
|
|
||||||
|
if (time.time() - self.last_action) < 10:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
if self.ping in message.content:
|
||||||
|
for msg in self.msg_buffer:
|
||||||
|
if self.ping in msg:
|
||||||
|
# Ping not adequately spaced
|
||||||
|
await message.channel.send(embed=embed.make_embed("Coronavirus Safety Information", "Due to the ongoing pandemic, please remember to space your NaughtyStep pings at least six messages apart.\n Thank you."))
|
||||||
|
self.last_action = time.time()
|
||||||
|
break
|
||||||
|
|
||||||
|
self.msg_buffer.pop(0)
|
||||||
|
self.msg_buffer.append(message.content)
|
||||||
|
|
||||||
|
def setup(client):
|
||||||
|
client.add_cog(Safety(client))
|
Loading…
Add table
Add a link
Reference in a new issue