Discord.js slash command role/channel options - discord

I'm using Discord.js to write a bot with a number of helpful commands, however I can't seem to find anywhere on either Discord's API docs or Discord.js' docs that lists an example of the json structure for a slash command's role and channel options. I have the commands registering properly, but don't know what sort of data those interactions give me.
TL;DR: what data is returned when I call the following:
interaction.options.getChannel("channelOptionName")
//and
interaction.options.getRole("roleOptionName")
I'm not able to run any code in any reasonable amount of time, so I'm not able to just console.log it and go from there.
Thanks in advance!

Related

Giving a webhook a name Discord.JS

I like using webhooks, and I think they work amazing, but what I can't figure out is giving a webhook a certain name for just one message.
You can do it by setting username in the JSON you send to Discord. The full documentation is available here: https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params

Is it possible to show by command how many voice channels my Discord bot is currently connected to?

I would like to display via command how many voice channels my bot is currently in, is this possible? Maybe also with extra things like the server ID/channel ID. This is not needed though, just the command and the amount would be good.
I already found a method for js but not for Discord.py.
You can use the Bot.voice_clients attribute
voice_states = bot.voice_clients # or client, however you named your instance
await ctx.send(f'I am currently in {len(voice_states)} voice channels')

One autherization method call for all users

I have a problem with setting up specific scnario in gatling.
I want to call my api to get authorization cookie, and then start the main scenario. I want to authorize only once, save the response, and then, for example, run test for 500 users for 30 minutes using the same auth cookie.
Is it possible to set up it like this? I'm not sure if it is possible using before hook.
I was searching for answer to this question, but I've found nothing. It would be great if I get some advices
I'm not sure if anybody needs answer to this question besides me, but I'll post what I had to do, to achieve my goal :)
I simply made post to authentication method before the scenario. I used scalaj-http library.
I saved a response in a varable and after this request was completed I run my scenario with passed variable

angularjs ngfacebook batch request

Can anyone who knows how to use the angularjs ngFacebook module help me to perform a facebook batch request? Is it possible to do it with this module?
What I need exactly is to get the user events from facebook, for that I have to do 4 different request:
$facebook.api('/me/events/attending').then(function(response) {//code here});
$facebook.api('/me/events/created').then(function(response) {//code here});
$facebook.api('/me/events/maybe').then(function(response) {//code here});
I think I could batch this request, I just don't know if it's possible to do using this module.
Also the most tricky part would be that, for each event returned I would need to get the owner, and with the owner.id to get his picture, right now what I do is:
$facebook.api('/me/events/attending?fields=owner').then(function(response) {
//And here I do a "for" into the events to request for each owner picture
});
Of course it doesn't seem the best way to do it, but I have searched a lot for the solution and I couldn't make anything work.
I think you should be able to request all user events, inluding the owner info:
GET /me/events?fields=id,name,owner{id,picture},rsvp_status
You can determine the "status" of the event to the user by the rsvp_status (attending, maybe, declined, no_reply) field.
See
https://developers.facebook.com/docs/graph-api/reference/v2.3/event#read
https://developers.facebook.com/docs/graph-api/reference/user/events/
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0#fieldexpansion
I'm not sure of the batch request protocol that Facebook uses but you could try this module.
https://github.com/jonsamwell/angular-http-batcher
If it doesn't support it add an issue and I'll looking into implementing it. Disclosure: I created this angular http batching library.

GMAIL API : How to get the reply without the original message

i'm using google api for gmail. All is working fine, i was able to connect, list and get message / thread, browse every elements of a thread etc...
I want to be able to retrieve a reply without the original message, is it somehow doable ?
I think that every email software will put together a different constructed reply message with the original message included but maybe there's a way to retrieve only the reply.
Thanks for any hint that will allow me to do such thing.
It appears the consensus is that this is not possible, and that the message/thread must be parsed manually with your program.

Resources