Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Interactions #1210

Closed
wants to merge 207 commits into from
Closed
Show file tree
Hide file tree
Changes from 198 commits
Commits
Show all changes
207 commits
Select commit Hold shift + click to select a range
1b8f2c6
Added interaction event, Added Interaction class (1)
JustCat80 May 29, 2021
4b99592
Fixed accidental commas
JustCat80 May 29, 2021
3f87031
Update Constants.js
JustCat80 May 29, 2021
ecd5c2f
Temp commented out InteractionData to test so far
JustCat80 May 29, 2021
6c27c37
Update Interaction.js
JustCat80 May 29, 2021
9a0f18c
Added endpoints
JustCat80 May 29, 2021
b00c738
Forgot / before urls
JustCat80 May 29, 2021
de0d435
Update Interaction.js
JustCat80 May 29, 2021
00d13a6
Update Interaction.js
JustCat80 May 29, 2021
51e9610
Update Interaction.js
JustCat80 May 29, 2021
d9308c8
Update Interaction.js
JustCat80 May 29, 2021
857fb7d
Update Interaction.js
JustCat80 May 29, 2021
647439c
Update Interaction.js
JustCat80 May 29, 2021
c6b1737
Update Interaction.js
JustCat80 May 29, 2021
396e040
Update Interaction.js
JustCat80 May 29, 2021
ded180f
Update Client.js
JustCat80 May 29, 2021
fcf85d0
Update Endpoints.js
JustCat80 May 29, 2021
ac7a010
Update Interaction.js
JustCat80 May 29, 2021
c768423
Update Interaction.js
JustCat80 May 30, 2021
e5acc18
Update Interaction.js
JustCat80 May 30, 2021
c4d3ae8
Update Interaction.js
JustCat80 May 30, 2021
6a87323
Interaction return changed
JustCat80 May 30, 2021
55455dc
Attempt to add Interaction Data
JustCat80 May 30, 2021
07aff1a
Update Interaction.js
JustCat80 May 30, 2021
67abcdb
Removed InteractionData.customId
JustCat80 May 30, 2021
afc67c4
Actually did InteractionData Docs
JustCat80 May 30, 2021
1830a3e
acknowledge is just a promise
JustCat80 May 30, 2021
b4d3928
Defer test
JustCat80 May 30, 2021
1f4f175
editResponse test
JustCat80 May 30, 2021
844a557
Update Interaction.js
JustCat80 May 30, 2021
820c502
Update Endpoints.js
JustCat80 May 30, 2021
4c087e0
Update Endpoints.js
JustCat80 May 30, 2021
990d640
Update Interaction.js
JustCat80 May 30, 2021
1b8ad83
editResponse Documentation
JustCat80 May 30, 2021
ea493da
Added testing for content
JustCat80 May 30, 2021
2efd06b
Removed duplicate endpoints
JustCat80 May 30, 2021
3d0dc68
Added createFollowup
JustCat80 May 30, 2021
17faf1d
Fixed acknowledge
JustCat80 May 30, 2021
48e0182
Update Interaction.js
JustCat80 May 30, 2021
b066de5
Update Interaction.js
JustCat80 May 30, 2021
f9c5c2b
Test log
JustCat80 May 30, 2021
25e75ff
Commented out broken .then statement
JustCat80 May 30, 2021
7be7a07
Changed some docs, added .edit
JustCat80 May 30, 2021
096e35b
Update Interaction.js
JustCat80 May 30, 2021
62d00b4
edit => editParent, editResponse => edit
JustCat80 May 30, 2021
24e9fdb
Removed editInteractionMessage
JustCat80 May 30, 2021
2c175be
Updated Docs
JustCat80 May 30, 2021
d86c2a0
Update Interaction.js
JustCat80 May 30, 2021
d748371
Update Interaction.js
JustCat80 May 30, 2021
d55c986
Added interaction.delete
JustCat80 May 30, 2021
01b9656
Update Interaction.js
JustCat80 May 30, 2021
fb16393
Update Interaction.js
JustCat80 May 30, 2021
5e51d79
Removed dead space between comments and functions
JustCat80 May 30, 2021
6a154f9
Update Interaction.js
JustCat80 May 30, 2021
c3dd29f
Added Name to InteractionData
JustCat80 May 30, 2021
c34e1f1
Added Requested changes
JustCat80 May 31, 2021
ca45388
Removed _client that i forgot to
JustCat80 May 31, 2021
705f90f
fixed small docs bit
JustCat80 May 31, 2021
9a9f891
Added this._client to all method calls, everything now actually works
JustCat80 May 31, 2021
0346700
Fixed Interaction docs
JustCat80 May 31, 2021
041369b
added flags to executewebhook for interactions
JustCat80 Jun 1, 2021
83000ee
added createInteractionResponse to ts docs
JustCat80 Jun 3, 2021
ba3ba4d
Fixed some docs
JustCat80 Jun 3, 2021
516e951
Made interaction functions docs InteractionOptions rather then Record…
JustCat80 Jun 3, 2021
bb119a8
Added missing client for member
JustCat80 Jun 9, 2021
1e1ef48
Added forgotten guild object
JustCat80 Jun 9, 2021
f604f61
Better docs + notes
JustCat80 Jun 10, 2021
63dc8fa
Updated some docs
JustCat80 Jun 14, 2021
626cda0
Added createFollowup options
JustCat80 Jun 14, 2021
315b668
Fixed up some ts docs
JustCat80 Jun 16, 2021
b89e659
Fixed delete docs, fixed needing embed when its embeds
JustCat80 Jun 26, 2021
f381d11
Moved docs a little
JustCat80 Jun 27, 2021
4bec30b
Components-only for editParent and edit
JustCat80 Jun 27, 2021
61ef4d8
Dont format allowedMentions because editWebhookMessage does right after
JustCat80 Jun 27, 2021
b529169
then => than in interaction docs
JustCat80 Jul 1, 2021
583d31f
Merge pull request #17 from abalabahaha/dev
JustCat80 Jul 2, 2021
d0bfd6e
Added forgotten property, fixed docs a little
JustCat80 Jul 3, 2021
c323eb6
Added forgotten consistent, actually follows styling now
JustCat80 Jul 3, 2021
6445515
Added endpoints, Added consistents
JustCat80 Jul 3, 2021
3a4e294
Id => ID
JustCat80 Jul 3, 2021
d968eb0
Add more endpoints
JustCat80 Jul 4, 2021
0b0ca56
Add most client slash command functions
JustCat80 Jul 4, 2021
0c6b60a
Fixed slash command docs
JustCat80 Jul 4, 2021
82a5b0a
Added most guild slash command functions
JustCat80 Jul 4, 2021
917ad5e
Merge pull request #19 from abalabahaha/dev
JustCat80 Jul 4, 2021
1d897fd
Merge pull request #20 from abalabahaha/dev
JustCat80 Jul 4, 2021
cdb48c3
bulkEditCommands
JustCat80 Jul 5, 2021
1025f24
Merge branch 'slash-commands' of https://github.com/Catboi8/eris into…
JustCat80 Jul 5, 2021
e8221b8
Fixed "will will" typo
JustCat80 Jul 8, 2021
4ade375
Removed unneeded if statements, embed => embeds, fixed docs
JustCat80 Jul 8, 2021
cece5b3
make interaction.edit messageId docs more clear
JustCat80 Jul 8, 2021
2d5e30c
Merge pull request #26 from abalabahaha/dev
JustCat80 Jul 8, 2021
2c3b9a1
Merge branch 'dev' of https://github.com/abalabahaha/eris into abalab…
JustCat80 Jul 13, 2021
a2d340a
Merge branch 'abalabahaha-dev' into interactions
JustCat80 Jul 13, 2021
c9f04d5
Merge pull request #30 from abalabahaha/dev
JustCat80 Jul 13, 2021
24611f7
Ignore .vscode
JustCat80 Jul 22, 2021
b796942
Remove Guild#deleteGuildCommand, fix some docs
JustCat80 Jul 24, 2021
d3bca79
docs improvements
JustCat80 Jul 14, 2021
1563fbd
Fixed some defer docs, acknowledge now has a reason to exist
JustCat80 Jul 24, 2021
f920556
Add Donovan's suggested changes, also values is now an array of strings
JustCat80 Jul 24, 2021
640dd05
embeds is now an actual array of EmbedOptions
JustCat80 Jul 24, 2021
f51df1f
Linted ts
JustCat80 Jul 24, 2021
1e229d4
Remove unrelated endpoints
JustCat80 Jul 24, 2021
7f8a911
Added interaction.getOriginal() https://discord.com/developers/docs/i…
JustCat80 Jul 24, 2021
de138c9
change function names to make more sense, ts docs
JustCat80 Jul 24, 2021
b86c761
"Warning: Will error with ephemeral messages." is now put below the n…
JustCat80 Jul 24, 2021
367c83a
slight jsdoc improvements
JustCat80 Jul 24, 2021
413e4f8
(see description) Added deleteOriginalMessage and editOriginalMessage
JustCat80 Jul 24, 2021
502bf7b
Id => ID
JustCat80 Jul 25, 2021
ecfe488
Fix some docs
JustCat80 Jul 25, 2021
346161b
Added suggested docs changes
JustCat80 Jul 26, 2021
ddab680
Added Permission Functions to client and guild
JustCat80 Jul 25, 2021
263976a
Added CommandTypes to Constants and command.type to jsdocs
JustCat80 Jul 26, 2021
018c592
Added ts docs :)
JustCat80 Jul 26, 2021
f8f5d8d
Oops, linted ts
JustCat80 Jul 26, 2021
21db1c5
Added NUMBER (type 10) to Constants.CommandOptionTypes
JustCat80 Jul 27, 2021
bc6ac9b
Update index.d.ts
JustCat80 Jul 30, 2021
01329b7
Added new Interaction types that extend Interaction, added ts docs, c…
JustCat80 Jul 31, 2021
b385744
fix ts docs
JustCat80 Jul 31, 2021
d229eeb
for...in => for...of
JustCat80 Jul 31, 2021
ad8a365
Merge branch 'slash-commands' into combine
JustCat80 Jul 31, 2021
1833fcf
Merge branch 'combine' into interactions
JustCat80 Jul 31, 2021
9995144
Forgot Linting
JustCat80 Jul 31, 2021
019df74
Added requested changes
JustCat80 Aug 1, 2021
ffcaaaa
Added more requested changes
JustCat80 Aug 1, 2021
2b7a69f
Assign wait to all createFollowup methods
JustCat80 Aug 1, 2021
1736286
Change value back to string
JustCat80 Aug 2, 2021
8c4d8f5
Fix Guild#bulkEditCommands
JustCat80 Aug 2, 2021
18acc95
Merge pull request #46 from Catboi8/interactions
JustCat80 Aug 3, 2021
2c0dd16
Added Interaction.acknowledged, update Interaction.acknowledged when …
JustCat80 Aug 3, 2021
865a8e8
acknowledged docs
JustCat80 Aug 4, 2021
19c27aa
Push Acknowledged consept to main interactions branch
JustCat80 Aug 4, 2021
fd0591c
Lint ts
JustCat80 Aug 4, 2021
199adda
Update lib/Client.js
JustCat80 Aug 5, 2021
8f06e44
Added file to createMessage docs because after the initial response y…
JustCat80 Aug 6, 2021
b002581
Docs changes, Constants changes
JustCat80 Aug 10, 2021
4415d02
Changed Constants COMMAND to CHAT_INPUT, changed name check
JustCat80 Aug 11, 2021
023cfc9
use raw messages when interaction messages are ephemeral
TTtie Aug 11, 2021
32bfdb5
use a bit mask instead of direct comparison
TTtie Aug 11, 2021
b9758e9
use an explicit 64 for PossiblyEphemeralMessage.flags
TTtie Aug 11, 2021
59e3ad6
Merge pull request #52 from TTtie/ephemeral-message-passthrough
JustCat80 Aug 11, 2021
62f4ce9
Removed InteractionFlags in favor of adding EPHEMERAL to MessageFlags…
JustCat80 Aug 11, 2021
8005cf0
Application Commands Example
JustCat80 Aug 11, 2021
d0b0347
Fix message context menu comment
JustCat80 Aug 11, 2021
5ba3648
editOriginalMessage doesnt error with ephemeral messages
JustCat80 Aug 12, 2021
b8ead26
Warn if no intents instead of allowing it to error, as Interactions d…
JustCat80 Aug 12, 2021
e5b9012
Change applicationCommands example
JustCat80 Aug 12, 2021
f60b1c0
Oops added an underscore to BOT TOKEN
JustCat80 Aug 12, 2021
629c4e5
Update Constants Names to be consistent
JustCat80 Aug 13, 2021
98812e8
Added docs for forgotten context menu data
JustCat80 Aug 13, 2021
b664099
remove PossiblyEphemeralMessage from ts docs
JustCat80 Aug 13, 2021
3171d82
Fix ComponentInteraction#message docs, make most message methods chec…
JustCat80 Aug 13, 2021
bcb7d53
CONTEXT_MENU_COMMAND message type
JustCat80 Aug 14, 2021
53126ed
APPLICATION_COMMAND => CHAT_INPUT_COMMAND
JustCat80 Aug 18, 2021
b008fcd
data => info in interaction classes, data.resolved fixed
JustCat80 Aug 19, 2021
b235b41
Oops, fix redefining things for no reason
JustCat80 Aug 19, 2021
822eca7
remove data.resolved for now
JustCat80 Aug 19, 2021
24d5808
remove unused things for now
JustCat80 Aug 19, 2021
a5058aa
Merge branch 'dev' of https://github.com/abalabahaha/eris into intera…
JustCat80 Aug 19, 2021
e3a4337
Add components to jsdocs
JustCat80 Aug 19, 2021
814450e
interaction.data.resolved is now actually set instead of just passing…
JustCat80 Aug 19, 2021
c201294
Fix PartialChannel and PartialRole having id set as number
JustCat80 Aug 19, 2021
a274d08
fixed docs to reflect that data.resolved are Collections
JustCat80 Aug 19, 2021
cbe1502
add APPLICATION_COMMAND events, will maybe add an ApplicationCommand …
JustCat80 Aug 20, 2021
04218b7
Revert commit cbe15029c223b20f73ae1a07905d9769f0126819 as these event…
JustCat80 Aug 20, 2021
f4474bd
fix message TypeError (hotfix by GweeKwee)
JustCat80 Aug 20, 2021
66c85cf
interaction.channelID is now interaction.channel, similar to message
JustCat80 Aug 20, 2021
e98706d
fix up message.interaction, make message use this._client so its cons…
JustCat80 Aug 20, 2021
5c20d05
Merge branch 'dev' into interactions
JustCat80 Aug 22, 2021
857f38b
use info.guild_id when defining members
JustCat80 Aug 22, 2021
bd11bd9
Update UnknownInteraction.message
JustCat80 Aug 23, 2021
0160823
Cache CommandInteraction.resolved users and members, cache interactio…
JustCat80 Aug 23, 2021
0e68d16
Change options.value to string | number | boolean for now
JustCat80 Aug 23, 2021
47c2bc8
first attempt
DonovanDMC Aug 24, 2021
01e0256
add stuff to unions
DonovanDMC Aug 24, 2021
d733b86
Merge pull request #61 from DonovanDMC/option-types
JustCat80 Aug 24, 2021
a7a5473
Convert to interfaces
JustCat80 Aug 24, 2021
cbbbe04
Add components to webhook content in ts
JustCat80 Aug 25, 2021
ce68e1e
Add Interaction classes to esm.mjs
JustCat80 Aug 25, 2021
0683a9c
Add ComponentTypes to constants because bsian didn't
JustCat80 Aug 29, 2021
1627d78
Even More Detailed Interaction Types (#63)
DonovanDMC Aug 29, 2021
4ea749b
ts hotfix
JustCat80 Aug 29, 2021
f303ae3
remove UnknownInteraction
JustCat80 Aug 29, 2021
7e19c81
Undo last commit
JustCat80 Aug 30, 2021
0540edb
export Interaction
JustCat80 Aug 30, 2021
04f3753
data.interaction.guild_id => data.guild_id in Message
JustCat80 Aug 31, 2021
6b69700
Can send files on initial interaction response, add .then update to U…
JustCat80 Sep 1, 2021
11ef7ea
More Fixes (#64)
DonovanDMC Sep 1, 2021
acc1d19
Fix Error: Only iterables may be used in a SetType (Catboi8#68)
JustCat80 Sep 16, 2021
9fcabf9
Added ephemeral to Attachment ts
JustCat80 Sep 16, 2021
4378029
Fix editParent typings
JustCat80 Sep 18, 2021
5cc97a4
Fix bulkEditCommandPermissions typings
JustCat80 Sep 23, 2021
13b5249
Add ts fixes, add channel_types to ApplicationCommandOptionsChannel
JustCat80 Sep 23, 2021
7945ee8
Merge branch 'interactions' of https://github.com/Catboi8/eris into i…
JustCat80 Sep 23, 2021
15fb74d
Oops
JustCat80 Sep 23, 2021
0de12ce
fix perms again xD
JustCat80 Sep 23, 2021
dd92bca
change all acknowledges, make PingInteraction consistent
JustCat80 Sep 23, 2021
0059f83
Autocomplete Interaction Support 🥳
JustCat80 Sep 23, 2021
393dc1b
Merge branch 'dev' of https://github.com/abalabahaha/eris into intera…
JustCat80 Sep 23, 2021
5d635b7
Fix js docs maybe
JustCat80 Sep 23, 2021
484a83b
a few fixes/improvements (#69)
DonovanDMC Sep 27, 2021
13c268e
ComponentTypes Lint
JustCat80 Sep 29, 2021
23bcc6e
Update index.d.ts
JustCat80 Oct 2, 2021
d7b21a4
Update index.d.ts
JustCat80 Oct 2, 2021
10c37a9
Add ButtonStyles to Constants
JustCat80 Oct 3, 2021
b21bc37
Components example
JustCat80 Oct 3, 2021
9f1d485
Oops forgot intents
JustCat80 Oct 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.vscode
docgen
docs
node_modules
Expand Down
6 changes: 6 additions & 0 deletions esm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default function(token, options) {
}

export const {
AutocompleteInteraction,
Base,
Bucket,
Call,
Expand All @@ -14,6 +15,8 @@ export const {
Collection,
Command,
CommandClient,
CommandInteraction,
ComponentInteraction,
Constants,
DiscordHTTPError,
DiscordRESTError,
Expand All @@ -24,12 +27,14 @@ export const {
GuildIntegration,
GuildPreview,
GuildTemplate,
Interaction,
Invite,
Member,
Message,
NewsChannel,
Permission,
PermissionOverwrite,
PingInteraction,
PrivateChannel,
Relationship,
RequestHandler,
Expand All @@ -40,6 +45,7 @@ export const {
StoreChannel,
TextChannel,
UnavailableGuild,
UnknownInteraction,
User,
VERSION,
VoiceChannel,
Expand Down
101 changes: 101 additions & 0 deletions examples/applicationCommands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
const Eris = require("eris");

const Constants = Eris.Constants;

// Replace TOKEN with your bot account's token
const bot = new Eris("BOT TOKEN", {
intents: [] //No intents are needed for interactions, but you still need to specify either an empty array or 0
});

bot.on("ready", async () => { // When the bot is ready
console.log("Ready!"); // Log "Ready!"

//Note: You should use guild commands to test, as they update instantly. Global commands can take up to an hour to update.

const commands = await bot.getCommands();

if(!commands.length) {
bot.createCommand({
name: "test_chat_input",
description: "Test command to show how to make commands",
options: [ //An array of Chat Input options https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
{
"name": "animal", //The name of the option
"description": "The type of animal",
"type": Constants.ApplicationCommandOptionTypes.STRING, //This is the type of string, see the types here https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
"required": true,
"choices": [ //The possible choices for the options
{
"name": "Dog",
"value": "animal_dog"
},
{
"name": "Cat",
"value": "animal_cat"
},
{
"name": "Penguin",
"value": "animal_penguin"
}
]
},
{
"name": "only_smol",
"description": "Whether to show only baby animals",
"type": Constants.ApplicationCommandOptionTypes.BOOLEAN,
"required": false
}
],
type: Constants.ApplicationCommandTypes.CHAT_INPUT //Not required for Chat input type, but recommended
}); //Create a chat input command

bot.createCommand({
name: "Test User Menu",
type: Constants.ApplicationCommandTypes.USER
}); //Create a user context menu

bot.createCommand({
name: "Test Message Menu",
type: Constants.ApplicationCommandTypes.MESSAGE
}); //Create a message context menu

bot.createCommand({
name: "test_edit_command",
description: "Test command to show off how to edit commands",
type: Constants.ApplicationCommandTypes.CHAT_INPUT //Not required for Chat input type, but recommended
}); //Create a chat input command

bot.createCommand({
name: "test_delete_command",
description: "Test command to show off how to delete commands",
type: Constants.ApplicationCommandTypes.CHAT_INPUT //Not required for Chat input type, but recommended
}); //Create a chat input command

//In practice, you should use bulkEditCommands if you need to create multiple commands
}
});

bot.on("error", (err) => {
console.error(err); // or your preferred logger
});

bot.on("interactionCreate", (interaction) => {
if(interaction instanceof Eris.CommandInteraction) {
switch(interaction.data.name) {
case "test_edit_command":
interaction.createMessage("interaction recieved");
return bot.editCommand(interaction.data.id, {
name: "edited_test_command",
description: "Test command that was edited by running test_edit_command"
});
case "test_delete_command":
interaction.createMessage("interaction recieved");
return bot.deleteCommand(interaction.data.id);
default: {
return interaction.createMessage("interaction recieved");
}
}
}
});

bot.connect(); // Get the bot to connect to Discord
Loading