parent
743b2ec318
commit
429e0706bd
@ -0,0 +1,5 @@
|
|||||||
|
from .leaver import Leaver
|
||||||
|
|
||||||
|
|
||||||
|
def setup(bot):
|
||||||
|
bot.add_cog(Leaver(bot))
|
@ -1,9 +1,20 @@
|
|||||||
{
|
{
|
||||||
"AUTHOR": "Bobloy",
|
"author": [
|
||||||
"INSTALL_MSG": "Thank you for installing leaver",
|
"Bobloy"
|
||||||
"NAME": "Leaver",
|
],
|
||||||
"SHORT": "Sends message on leave",
|
"bot_version": [
|
||||||
"DESCRIPTION": "Keeps track of when people leave the server, and posts a message notifying",
|
3,
|
||||||
"TAGS": ["fox", "bobloy", "utilities", "tools", "tool"],
|
0,
|
||||||
"HIDDEN": false
|
0
|
||||||
|
],
|
||||||
|
"description": "Keeps track of when people leave the server, and posts a message notifying",
|
||||||
|
"hidden": false,
|
||||||
|
"install_msg": "Thank you for installing Leaver. Get started with `[p]help Leaver`",
|
||||||
|
"requirements": [],
|
||||||
|
"short": "Send message on leave",
|
||||||
|
"tags": [
|
||||||
|
"bobloy",
|
||||||
|
"utils",
|
||||||
|
"tools"
|
||||||
|
]
|
||||||
}
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
from .nudity import Nudity
|
||||||
|
|
||||||
|
|
||||||
|
def setup(bot):
|
||||||
|
bot.add_cog(Nudity(bot))
|
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"author": [
|
||||||
|
"Bobloy"
|
||||||
|
],
|
||||||
|
"bot_version": [
|
||||||
|
3,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"description": "Keep track of when users were last seen online",
|
||||||
|
"hidden": true,
|
||||||
|
"install_msg": "Thank you for installing LastSeen. Get started with `[p]help LastSeen`",
|
||||||
|
"requirements": [],
|
||||||
|
"short": "Last seen tracker",
|
||||||
|
"tags": [
|
||||||
|
"bobloy",
|
||||||
|
"utils",
|
||||||
|
"tools"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
import dateutil.parser
|
||||||
|
import discord
|
||||||
|
from redbot.core import Config
|
||||||
|
from redbot.core import commands
|
||||||
|
from redbot.core.bot import Red
|
||||||
|
|
||||||
|
|
||||||
|
class Nudity:
|
||||||
|
"""
|
||||||
|
V3 Cog Template
|
||||||
|
"""
|
||||||
|
|
||||||
|
online_status = discord.Status.online
|
||||||
|
|
||||||
|
offline_status = discord.Status.offline
|
||||||
|
|
||||||
|
def __init__(self, bot: Red):
|
||||||
|
self.bot = bot
|
||||||
|
self.config = Config.get_conf(self, identifier=9811198108111121, force_registration=True)
|
||||||
|
default_global = {}
|
||||||
|
default_guild = {
|
||||||
|
"enabled": True
|
||||||
|
}
|
||||||
|
default_member = {
|
||||||
|
"seen": None
|
||||||
|
}
|
||||||
|
|
||||||
|
self.config.register_global(**default_global)
|
||||||
|
self.config.register_guild(**default_guild)
|
||||||
|
self.config.register_member(**default_member)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_date_time(s):
|
||||||
|
d = dateutil.parser.parse(s)
|
||||||
|
return d
|
||||||
|
|
||||||
|
@commands.group(aliases=['setlseen'], name='lseenset')
|
||||||
|
async def lset(self, ctx: commands.Context):
|
||||||
|
"""Change settings for lseen"""
|
||||||
|
if ctx.invoked_subcommand is None:
|
||||||
|
await ctx.send_help()
|
||||||
|
|
||||||
|
@lset.command(name="toggle")
|
||||||
|
async def lset_toggle(self, ctx: commands.Context):
|
||||||
|
"""Toggles tracking seen for this server"""
|
||||||
|
enabled = not await self.config.guild(ctx.guild).enabled()
|
||||||
|
await self.config.guild(ctx.guild).enabled.set(
|
||||||
|
enabled)
|
||||||
|
|
||||||
|
await ctx.send(
|
||||||
|
"Seen for this server is now {}".format(
|
||||||
|
"Enabled" if enabled else "Disabled"))
|
||||||
|
|
||||||
|
@commands.command(aliases=['lastseen'])
|
||||||
|
async def lseen(self, ctx: commands.Context, member: discord.Member):
|
||||||
|
"""
|
||||||
|
Just says the time the user was last seen
|
||||||
|
"""
|
||||||
|
|
||||||
|
if member.status != self.offline_status:
|
||||||
|
last_seen = datetime.utcnow()
|
||||||
|
else:
|
||||||
|
last_seen = await self.config.member(member).seen()
|
||||||
|
if last_seen is None:
|
||||||
|
await ctx.send(embed=discord.Embed(description="I've never seen this user"))
|
||||||
|
return
|
||||||
|
last_seen = self.get_date_time(last_seen)
|
||||||
|
|
||||||
|
# embed = discord.Embed(
|
||||||
|
# description="{} was last seen at this date and time".format(member.display_name),
|
||||||
|
# timestamp=self.get_date_time(last_seen))
|
||||||
|
|
||||||
|
embed = discord.Embed(timestamp=last_seen)
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
# async def on_socket_raw_receive(self, data):
|
||||||
|
# try:
|
||||||
|
# if type(data) == str:
|
||||||
|
# raw = json.loads(data)
|
||||||
|
# print(data)
|
||||||
|
# except:
|
||||||
|
# print(data)
|
||||||
|
|
||||||
|
async def on_member_update(self, before: discord.Member, after: discord.Member):
|
||||||
|
if before.status != self.offline_status and after.status == self.offline_status:
|
||||||
|
if not await self.config.guild(before.guild).enabled():
|
||||||
|
return
|
||||||
|
await self.config.member(before).seen.set(datetime.utcnow().isoformat())
|
Loading…
Reference in new issue