{"id":22964716,"url":"https://github.com/alexisl61/discordinteraction","last_synced_at":"2025-06-20T01:05:19.676Z","repository":{"id":57212598,"uuid":"382920226","full_name":"AlexisL61/DiscordInteraction","owner":"AlexisL61","description":null,"archived":false,"fork":false,"pushed_at":"2021-07-04T18:47:37.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-20T01:05:10.894Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexisL61.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-04T18:18:34.000Z","updated_at":"2021-07-04T18:47:39.000Z","dependencies_parsed_at":"2022-09-07T09:50:27.854Z","dependency_job_id":null,"html_url":"https://github.com/AlexisL61/DiscordInteraction","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AlexisL61/DiscordInteraction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexisL61%2FDiscordInteraction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexisL61%2FDiscordInteraction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexisL61%2FDiscordInteraction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexisL61%2FDiscordInteraction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexisL61","download_url":"https://codeload.github.com/AlexisL61/DiscordInteraction/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexisL61%2FDiscordInteraction/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260857363,"owners_count":23073435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T20:12:04.503Z","updated_at":"2025-06-20T01:05:14.658Z","avatar_url":"https://github.com/AlexisL61.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord Interaction\n\nA library that let you use message interaction in your discord.js messages !\n\n## Example\n\nAdd a button to a message: \n```js\n//Create a MessageInteraction\nvar messageToSend = new MessageInteraction(\"Message\",message.channel)\n//Add a button\nmessageToSend.addButton(\"Button\",1,\"my_button\")\n//Send the message\nchannel.send(messageToSend)\n```\n\nAdd a select menu to a message: \n```js\n//Create a MessageInteraction\nvar messageToSend = new MessageInteraction(\"Message\",message.channel)\n//Create an array of options\nvar menuOptions = [{\"label\":\"First option\",\"value\":\"first_option\",\"description\":\"Description for the first option\",\"emoji\":{\"name\":\"😄\"}}]\n//Add the select menu to the message\nmessageToSend.addSelectMenu(\"my_select_menu\",menuOptions,\"My select menu\",1,1)\n//Send the message\nmessage.channel.send(messageToSend)\n```\n\nAwait a button to be clicked\n```js\n    //Create a MessageInteraction\n    var messageToSend = new MessageInteraction(\"Message\",message.channel)\n    //Add a button\n    messageToSend.addButton(\"Button\",1,\"my_button\")\n    //Send the message\n    var messageSent = await message.channel.send(messageToSend)\n    //Await for the button to be clicked\n    var buttonClicked = await MessageInteraction.awaitButtonClicked(messageSent)\n    //Receive the data of the button ({\"custom_id\",\"component_type\"}) and the member who clicked on the button\n    console.log(buttonClicked.data,buttonClicked.member)\n```\n\nAwait a select menu to be clicked\n```js\n    //Create a MessageInteraction\n    var messageToSend = new MessageInteraction(\"Message\",message.channel)\n    //Create an array of options\n    var menuOptions = [{\"label\":\"First option\",\"value\":\"first_option\",\"description\":\"Description for the first option\",\"emoji\":{\"name\":\"😄\"}}]\n    //Add the select menu to the message\n    messageToSend.addSelectMenu(\"my_select_menu\",menuOptions,\"My select menu\",1,1)\n    //Send the message\n    var messageSent = await message.channel.send(messageToSend)\n    //Await for the button to be clicked\n    var selectMenuClicked = await MessageInteraction.awaitSelectMenuClicked(messageSent)\n    //Receive the data of the button ({\"custom_id\",\"component_type\",\"values\":[]}) and the member who clicked on the button\n    console.log(selectMenuClicked.data,selectMenuClicked.member)\n```\n\nRespond to an interaction\n```js\n    //Create a MessageInteraction\n    var messageToSend = new MessageInteraction(\"Message\",message.channel)\n    //Add a button\n    messageToSend.addButton(\"Button\",1,\"my_button\")\n    //Send the message\n    var messageSent = await message.channel.send(messageToSend)\n    //Await for the button to be clicked\n    var buttonClicked = await MessageInteraction.awaitButtonClicked(messageSent)\n    //Respond to the interaction\n    MessageInteraction.respondToInteraction(buttonClicked.id,buttonClicked.token)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexisl61%2Fdiscordinteraction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexisl61%2Fdiscordinteraction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexisl61%2Fdiscordinteraction/lists"}