You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DiscordPHP EventLogger is a tool designed to generate user logs for the DiscordPHP API Library. It logs various events such as member joins/leaves, message deletions, role updates, and more.
4
+
5
+
## Features
6
+
7
+
- Logs member joins and leaves
8
+
- Logs message deletions and updates
9
+
- Logs role creations, deletions, and updates
10
+
- Logs channel creations, deletions, and updates
11
+
- Logs bans and unbans
12
+
13
+
## Installation
14
+
15
+
To install the DiscordPHP EventLogger, you need to have Composer installed. Run the following command:
Set the `DISCORDPHP_EVENTLOGGER_GUILD_CHANNELS` environment variable to specify the guilds and their respective log channels. The value should be a comma-separated string where each entry is a guild-channel pair separated by a hyphen.
* Creates an Embed object with the specified footer and color.
18
+
*
19
+
* @param bool|null $footer Whether to include the footer in the embed. Defaults to true.
20
+
* @param int|null $color The color of the embed. Defaults to null.
21
+
*
22
+
* @return Embed The created Embed object.
23
+
*/
24
+
privatestaticfunctioncreateEmbed(
25
+
Discord$discord,
26
+
string|int|null$color = null,
27
+
string|null$footer = null
28
+
): Embed
29
+
{
30
+
return (newEmbed($discord))
31
+
->setFooter($footer ?: '')
32
+
->setColor($color ?: null)
33
+
->setTimestamp()
34
+
->setURL('');
35
+
}
36
+
37
+
/**
38
+
* Fills an Embed object with the provided fields.
39
+
*
40
+
* @param string|null $title The title of the embed (Event).
41
+
* @param string|null $description The description of the embed.
42
+
* @param Embed|null $embed The Embed object to fill. If null, a new Embed object will be created.
43
+
* @param Discord|null $discord The Discord instance. If null, an Embed instance must be provided.
44
+
* @param string|int|null $color The color of the embed. Can be a hex string or an integer. If null, a default color will be used.
45
+
* @param string|null $embed_footer The footer text of the embed. If null, no footer will be added.
46
+
* @param array $fields Array containing associative arrays of fields to add to the Embed. Each field should have 'name', 'value', and optionally 'inline' keys.
47
+
* @return Embed The filled Embed object.
48
+
* @throws \Exception If both Discord and Embed instances are null.
49
+
*/
50
+
publicstaticfunctionnew(
51
+
Embed|null$embed = null,
52
+
string|null$title = null, // Event
53
+
string|null$description = null,
54
+
array$fields = [],
55
+
Discord|null$discord = null,
56
+
string|int|null$color = null,
57
+
string|null$footer = null
58
+
): Embed
59
+
{
60
+
if ($discord === null && $embed === null) thrownew \Exception('Either Discord or Embed instance must be provided');
0 commit comments