add sdate & message logs
This commit is contained in:
parent
7f678160dc
commit
880f8ff09e
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
__pycache__
|
|
@ -1,4 +1,4 @@
|
||||||
from discord.commands import slash_command
|
import discord.commands
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ class Fun(commands.Cog, name="Fun"):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@slash_command()
|
@slash_command(name='sdate', description='Returns the current Eternal September date', guild_ids=[950115668806746162])
|
||||||
async def sdate(ctx):
|
async def sdate(self, ctx):
|
||||||
sdate = (date.today() - date(1993, 8, 30)).days
|
sdate = (date.today() - date(1993, 8, 30)).days
|
||||||
await ctx.respond(sdate)
|
await ctx.respond(f"Today is September {sdate}, 1993.")
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(Fun(bot))
|
bot.add_cog(Fun(bot))
|
|
@ -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))
|
|
@ -11,6 +11,7 @@ class Kiafumi(discord.Bot):
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print(f'Logged on as {bot.user}!')
|
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
|
Loading…
Reference in a new issue