This repository has been archived by the owner on Apr 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d12586d
commit c273bb2
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |