Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
Merge v1.0.0
  • Loading branch information
0xDevansh committed Dec 24, 2021
2 parents ff47966 + 7ba7136 commit 16b1f80
Show file tree
Hide file tree
Showing 19 changed files with 313 additions and 106 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ You can look at recent commits to see examples. Please don't commit a lot of cha

- Take a look over the code you have added or changed. Make sure it is readable and properly commented.
- **run the lint script** before committing (`npm run lint` or `yarn lint`)
- - **run the docs script** to rebuild docs before committing (`npm run docs` or `yarn docs`)
46 changes: 38 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import Marshal from 'djs-marshal'
import { Intents } from "discord.js";
import path from 'path';

// you can pass in the token to make the client
// login automatically
// https://deathvenom54.github.io/djs-marshal/modules.html#initializeBot
const client = Marshal.initializeBot({
intents: [Intents.FLAGS.GUILDS],
// you can pass in the token to make the client login
// automatically
token: 'your-token-here',
// this is the folder path that contains your commands
slashCommandsPath: path.join(__dirname, 'commands'),
Expand All @@ -56,13 +56,16 @@ import { SlashCommand } from "djs-marshal";
// a pretty basic command. command is a discord.js
// CommandInteraction and you can use its methods like
// reply, defer, editReply, etc.
export default {
const ping: SlashCommand = {
name: 'ping',
description: 'Play ping-pong with me',
commandType: 'global',
execute (command) {
command.reply('Pong!')
}
} as SlashCommand;
};

export default ping;
// https://deathvenom54.github.io/djs-marshal/modules.html#SlashCommand
```

Expand All @@ -72,32 +75,59 @@ import { SlashCommand } from "djs-marshal";

// any command with a guildId specified is registered as
// as a guild command and will only work in that guild
export default {
const guildPing: SlashCommand = {
name: 'guildping',
description: 'Play ping-pong with me in this server',
commandType: 'guild',
guildId: '873232757508157470',
execute (command) {
command.reply('Peng!');
}
} as SlashCommand;
};

export default guildPing;
```

```ts
// deferredPing.js|ts
import { SlashCommand } from "djs-marshal";

// you can pass in defer as true to defer the interaction beforehand
export default {
const deferredPing: SlashCommand = {
name: 'slothping',
description: 'piiiiiinnnnnng',
commandType: 'global',
// you can also use deferEphemeral to mark the reply ephemeral
defer: true,
execute (command) {
setInterval(() =>{
command.editReply('Pooooooonnnngg!');
}, 3000)
}
} as SlashCommand;
};

export default deferredPing;
```

```ts
// secret.js|ts
import { SlashCommand } from "djs-marshal";

const secret: SlashCommand = {
name: 'secret',
description: 'Only for server moderators',
// this command is registered in all the
// guilds the bot is in
commandType: 'allGuild',
// this disables the command for anyone who
// doesn't have any of these permissions
allowWithPermission: ['MANAGE_SERVER'],
async execute (command) {
command.reply('Secret moderators stuff')
}
};

export default secret;
```

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 16b1f80

Please sign in to comment.