Skip to content
This repository has been archived by the owner on Apr 15, 2022. It is now read-only.

Commit

Permalink
added logging
Browse files Browse the repository at this point in the history
  • Loading branch information
joseywoermann committed Feb 11, 2021
1 parent d12586d commit c273bb2
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion commands/developer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, client):

@commands.command()
async def developer(self, ctx):
dev_embed = discord.Embed(description="[Twitter](https://twitter.com/joseywoermann/) - [Website](http://joseywoermann.tk/) - [GitHub](https://github.com/joseywoermann/)\n\n[Discord](https://discord.gg/SchJckc) - [Reddit](https://reddit.com/u/joseywoermann/) - [](https://github.com/joseywoermann/)", colour=discord.Colour.dark_grey())
dev_embed = discord.Embed(description="[Twitter](https://twitter.com/joseywoermann/) - [Website](https://joseywoermann.ml/) - [GitHub](https://github.com/joseywoermann/)\n\n[Discord](https://discord.gg/SchJckc) - [Reddit](https://reddit.com/u/joseywoermann/) - [Github](https://github.com/joseywoermann/)", colour=discord.Colour.dark_grey())

dev_embed.set_author(name=ctx.message.author,icon_url=ctx.author.avatar_url)
await ctx.reply(embed = dev_embed)
Expand Down
41 changes: 41 additions & 0 deletions core/command_logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import discord
from discord.ext import commands
import logging
from time import sleep

class CommandLogger(commands.Cog):

def __init__(self, client):
self.client = client

@commands.Cog.listener()
async def on_message(self, message):

server = message.guild

if message.content.startswith("$"):

if server.id == 304191437652623360:

log_channel = self.client.get_channel(751879355344617582)

log_embed = discord.Embed(title=message.content, description="Channel: **{0.channel.name}** Channel-ID: [{0.channel.id}]".format(message))
log_embed.set_author(name="User: " + message.author.name + "#" + str(message.author.discriminator) + " ID: " + str(message.author.id), icon_url=message.author.avatar_url)
log_embed.set_footer(text=message.created_at.strftime("%Y; %m. %d., %H:%M:%S") + " Server: " + str(message.channel.guild) + " / " + str(message.guild.id))

await log_channel.send(content=None, embed=log_embed)

else:

log_channel = self.client.get_channel(751879443810615487)

log_embed = discord.Embed(title=message.content, description=" Channel: **{0.channel.name}** Channel-ID: [{0.channel.id}]".format(message))
log_embed.set_author(name="User: " + message.author.name + "#" + str(message.author.discriminator) + " ID: " + str(message.author.id), icon_url=message.author.avatar_url)
log_embed.set_footer(text=message.created_at.strftime("%Y; %m. %d., %H:%M:%S") + " Server: " + str(message.channel.guild) + " / " + str(message.guild.id))

await log_channel.send(content=None, embed=log_embed)



def setup(client):
client.add_cog(CommandLogger(client))
18 changes: 18 additions & 0 deletions core/server_logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import discord
from discord.ext import commands
import logging
from asyncio import sleep

class Join_leave_notification(commands.Cog):

def __init__(self, client):
self.client = client


@commands.Cog.listener()
async def on_guild_join(self, ctx):
owner = self.client.get_user(586206645592391711)
await owner.send("Joined server \"" + str(ctx.name) + "\" (" + str(ctx.id) + ")")

def setup(client):
client.add_cog(Join_leave_notification(client))

0 comments on commit c273bb2

Please sign in to comment.