Skip to content
Closed
Changes from all commits
Commits
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
19 changes: 17 additions & 2 deletions src/dpp/slashcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,23 @@ void from_json(const nlohmann::json& j, interaction& i) {
}
}
j.at("member").get_to(i.member);
i.member.user_id = i.usr.id;
i.member.guild_id = i.guild_id;
// i.member.user_id = i.usr.id;
// i.member.guild_id = i.guild_id;
// Unfortunately, you cannot send a response in a direct message using a slash command. The response will be sent in the same channel as the slash
// command was executed. You can send the response as a normal message.
//You'll have to manually get the member, by either getting it from the cache or fetching it from the API.

// const user = client.users.cache.get(interaction.member.user.id);
// user.send("Hello").catch(console.error);

// or you can use this
client.ws.on("INTERACTION_CREATE", async interaction => {
const guild = client.guilds.cache.get(interaction.guild_id);
const user = client.users.cache.get(interaction.member.user.id);

user.send(`hello, you used the ${interaction.data.name.toLowerCase()} command in ${guild.name}`).catch(console.error);
});

if (i.cache_policy.user_policy != dpp::cp_none) {
/* User caching on, lazy or aggressive - cache or update the member information */
guild* g = dpp::find_guild(i.guild_id);
Expand Down