add sdate & message logs

This commit is contained in:
Anya 2022-03-06 20:19:24 -08:00
parent 7f678160dc
commit 880f8ff09e
4 changed files with 36 additions and 6 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
__pycache__

View file

@ -1,4 +1,4 @@
from discord.commands import slash_command
import discord.commands
from discord.ext import commands
from datetime import date
@ -6,10 +6,10 @@ class Fun(commands.Cog, name="Fun"):
def __init__(self, bot):
self.bot = bot
@slash_command()
async def sdate(ctx):
@slash_command(name='sdate', description='Returns the current Eternal September date', guild_ids=[950115668806746162])
async def sdate(self, ctx):
sdate = (date.today() - date(1993, 8, 30)).days
await ctx.respond(sdate)
await ctx.respond(f"Today is September {sdate}, 1993.")
def setup(bot):
bot.add_cog(Fun(bot))

View file

@ -0,0 +1,28 @@
import discord.commands
from discord.ext import commands
import datetime
class Moderation(commands.Cog, name="Moderation"):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_member_join(self, member):
guild = member.guild
if guild.system_channel is not None:
embed = discord.Embed(color=discord.Color.green(), description=f"{member.mention} | **Joined Discord**: {member.created_at.date()}", timestamp=datetime.datetime.now())
embed.set_author(name=f"{member} ({member.id})", icon_url=f"{member.display_avatar.url}?128")
embed.set_footer(text="User Left")
await guild.system_channel.send(embeds=[embed])
@commands.Cog.listener()
async def on_member_remove(self, member):
guild = member.guild
if guild.system_channel is not None:
embed = discord.Embed(color=discord.Color.red(), description=f"{member.mention} | **Joined Server**: {member.joined_at.date()}", timestamp=datetime.datetime.now())
embed.set_author(name=f"{member} ({member.id})", icon_url=f"{member.display_avatar.url}?128")
embed.set_footer(text="User Left")
await guild.system_channel.send(embeds=[embed])
def setup(bot):
bot.add_cog(Moderation(bot))

View file

@ -11,6 +11,7 @@ class Kiafumi(discord.Bot):
async def on_ready():
print(f'Logged on as {bot.user}!')
bot.load_extension('commands.fun') # cogs_folder.filename
for ext in ['commands.fun', 'commands.moderation']:
bot.load_extension(ext)
bot.run("OTUwMTA4Nzg3MTExNTIyMzc0.YiUHww.s4ydKNtD9sTB1OpQGYdnorDf5JY")
bot.run("") # token