-
-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #676 from hwangsihu/main
Update
- Loading branch information
Showing
8 changed files
with
286 additions
and
183 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,71 @@ | ||
import { ChannelType } from "discord.js"; | ||
import { Command, type Context, type Lavamusic } from "../../structures/index.js"; | ||
|
||
export default class CreateInvite extends Command { | ||
constructor(client: Lavamusic) { | ||
super(client, { | ||
name: "createinvite", | ||
description: { | ||
content: "Create a one-time use, unlimited duration invite link for a guild", | ||
examples: ["createinvite 0000000000000000000"], | ||
usage: "createinvite <guildId>", | ||
}, | ||
category: "dev", | ||
aliases: ["ci"], | ||
cooldown: 3, | ||
args: true, | ||
player: { | ||
voice: false, | ||
dj: false, | ||
active: false, | ||
djPerm: null, | ||
}, | ||
permissions: { | ||
dev: true, | ||
client: ["SendMessages", "CreateInstantInvite", "ReadMessageHistory", "ViewChannel"], | ||
user: [], | ||
}, | ||
slashCommand: false, | ||
options: [], | ||
}); | ||
} | ||
|
||
public async run(client: Lavamusic, ctx: Context, args: string[]): Promise<any> { | ||
const guildId = args[0]; | ||
|
||
const guild = client.guilds.cache.get(guildId); | ||
|
||
if (!guild) { | ||
return await ctx.sendMessage("Guild not found."); | ||
} | ||
|
||
try { | ||
const textChannel = guild.channels.cache.find((channel) => channel.type === ChannelType.GuildText); | ||
|
||
if (!textChannel) { | ||
return await ctx.sendMessage("No text channel found in the guild."); | ||
} | ||
|
||
const invite = await textChannel.createInvite({ | ||
maxUses: 1, | ||
maxAge: 0, | ||
}); | ||
|
||
await ctx.author.send(`Guild: ${guild.name}\nInvite Link: ${invite.url}`); | ||
await ctx.sendMessage("Invite link has been sent to your DM."); | ||
} catch (_error) { | ||
await ctx.sendMessage("Failed to create invite link."); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Project: lavamusic | ||
* Author: Appu | ||
* Main Contributor: LucasB25 | ||
* Company: Coders | ||
* Copyright (c) 2024. All rights reserved. | ||
* This code is the property of Coder and may not be reproduced or | ||
* modified without permission. For more information, contact us at | ||
* https://discord.gg/ns8CTk9J3e | ||
*/ |
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,65 @@ | ||
import { Command, type Context, type Lavamusic } from "../../structures/index.js"; | ||
|
||
export default class DestroyInvites extends Command { | ||
constructor(client: Lavamusic) { | ||
super(client, { | ||
name: "destroyinvites", | ||
description: { | ||
content: "Destroy all invite links created by the bot in a guild", | ||
examples: ["destroyinvites 0000000000000000000"], | ||
usage: "destroyinvites <guildId>", | ||
}, | ||
category: "dev", | ||
aliases: ["di"], | ||
cooldown: 3, | ||
args: true, | ||
player: { | ||
voice: false, | ||
dj: false, | ||
active: false, | ||
djPerm: null, | ||
}, | ||
permissions: { | ||
dev: true, | ||
client: ["SendMessages", "ManageGuild", "ReadMessageHistory", "ViewChannel"], | ||
user: [], | ||
}, | ||
slashCommand: false, | ||
options: [], | ||
}); | ||
} | ||
|
||
public async run(client: Lavamusic, ctx: Context, args: string[]): Promise<any> { | ||
const guildId = args[0]; | ||
|
||
const guild = client.guilds.cache.get(guildId); | ||
|
||
if (!guild) { | ||
return await ctx.sendMessage("Guild not found."); | ||
} | ||
|
||
try { | ||
const invites = await guild.invites.fetch(); | ||
|
||
const botInvites = invites.filter((invite) => invite.inviter?.id === client.user?.id); | ||
for (const invite of botInvites.values()) { | ||
await invite.delete(); | ||
} | ||
|
||
await ctx.sendMessage(`Destroyed ${botInvites.size} invite(s) created by the bot.`); | ||
} catch (_error) { | ||
await ctx.sendMessage("Failed to destroy invites."); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Project: lavamusic | ||
* Author: Appu | ||
* Main Contributor: LucasB25 | ||
* Company: Coders | ||
* Copyright (c) 2024. All rights reserved. | ||
* This code is the property of Coder and may not be reproduced or | ||
* modified without permission. For more information, contact us at | ||
* https://discord.gg/ns8CTk9J3e | ||
*/ |
Oops, something went wrong.