diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed8ebf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ \ No newline at end of file diff --git a/commands/fun.py b/commands/fun.py index 810427f..8012520 100644 --- a/commands/fun.py +++ b/commands/fun.py @@ -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)) \ No newline at end of file diff --git a/commands/moderation.py b/commands/moderation.py index e69de29..c69d372 100644 --- a/commands/moderation.py +++ b/commands/moderation.py @@ -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)) \ No newline at end of file diff --git a/kiafumi.py b/kiafumi.py index ea9e00e..087bd85 100644 --- a/kiafumi.py +++ b/kiafumi.py @@ -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") \ No newline at end of file +bot.run("") # token \ No newline at end of file