-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
54 changed files
with
1,260 additions
and
884 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
declare module "*.png" | ||
declare module "*.jpg" | ||
declare module "*.gif" | ||
declare module "*.mp3" | ||
declare module "*.wav" | ||
declare module "*.mp4" | ||
declare module "*.mov" | ||
declare module "*.webm" | ||
declare module "*.webp" | ||
declare module "*.sql" | ||
declare module "*.txt" | ||
declare module "*.glb" | ||
declare module "*.obj" | ||
declare module "*.fbx" | ||
declare module "*.ttf" | ||
declare module "*.otf" |
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
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 |
---|---|---|
@@ -1,32 +1,31 @@ | ||
import {Guild, GuildAuditLogsEntry, Message, TextChannel, User} from "discord.js" | ||
import {Guild, GuildAuditLogsEntry, AuditLogEvent, TextChannel, User, GuildBan} from "discord.js" | ||
import {Embeds} from "./../structures/Embeds" | ||
import {Functions} from "./../structures/Functions" | ||
import {Kisaragi} from "./../structures/Kisaragi" | ||
import {SQLQuery} from "./../structures/SQLQuery" | ||
|
||
export default class GuildBanAdd { | ||
constructor(private readonly discord: Kisaragi) {} | ||
|
||
public run = async (guild: Guild, user: User) => { | ||
public run = async (ban: GuildBan) => { | ||
const discord = this.discord | ||
const message = await discord.fetchFirstMessage(guild) | ||
const message = await discord.fetchFirstMessage(ban.guild) | ||
const sql = new SQLQuery(message!) | ||
const embeds = new Embeds(discord, message!) | ||
|
||
const logBan = async (guild: Guild, user: User) => { | ||
const logBan = async (guild: Guild) => { | ||
const modLog = await sql.fetchColumn("guilds", "mod log") | ||
if (modLog) { | ||
const modChannel = guild?.channels.cache.get(modLog)! as TextChannel | ||
const log = await guild.fetchAuditLogs({type: "MEMBER_BAN_ADD", limit: 1}).then((l) => l.entries.first()) | ||
const log = await guild.fetchAuditLogs({type: AuditLogEvent.MemberBanAdd, limit: 1}).then((l) => l.entries.first()) | ||
.catch(async () => { | ||
await modChannel.send(`I need the **View Audit Logs** permission in order to log guild bans.`).catch(() => null) | ||
return | ||
}) as GuildAuditLogsEntry | ||
if (!log) return | ||
const data = {type: "ban", user: (log.target as User).id, executor: log.executor.id, date: Date.now(), guild: guild.id, reason: log.reason} | ||
const data = {type: "ban", user: (log.target as User).id, executor: log.executor?.id, date: Date.now(), guild: guild.id, reason: log.reason} | ||
discord.emit("caseUpdate", data) | ||
} | ||
} | ||
logBan(guild, user) | ||
logBan(ban.guild) | ||
} | ||
} |
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
Oops, something went wrong.