This repository has been archived by the owner on Jan 26, 2024. It is now read-only.
-
-
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
CrawlTheDev
committed
Jun 5, 2021
1 parent
36e9316
commit 9e2172d
Showing
10 changed files
with
148 additions
and
92 deletions.
There are no files selected for viewing
File renamed without changes.
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,35 @@ | ||
import { ICommand, CommandContext } from '..'; | ||
|
||
export default class ChangePrefixCommand implements ICommand { | ||
name = 'change-prefix'; | ||
|
||
async execute(ctx: CommandContext, prefix: string): Promise<void> { | ||
if (ctx.guild.me.hasPermission('ADMINISTRATOR')) { | ||
const guild = await ctx.database.findGuildById(ctx.guild.id); | ||
|
||
if (guild) { | ||
if (prefix) { | ||
if (prefix === guild.main.prefix) { | ||
await ctx.channel.send( | ||
'Please provide a different prefix than the previous prefix' | ||
); | ||
} else { | ||
guild.main.prefix = prefix; | ||
await guild.save(); | ||
await ctx.channel.send('Prefix changed to: ' + guild?.main.prefix); | ||
} | ||
} else { | ||
await ctx.channel.send('Please provide a valid prefix'); | ||
} | ||
} else { | ||
await ctx.channel.send( | ||
`Guild with id **'${ctx.guild.id}'** not found in database` | ||
); | ||
} | ||
} else { | ||
await ctx.channel.send( | ||
"You don't have permission(`ADMINISTRATOR`) for use this command" | ||
); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.