client.guilds.cache.get('<id>').channel.create(message.author.username, 'text');
I'm trying to use this code here to create a text channel titled with the message author's username, but I can't get the specified server (the ID is correct).
If you want to create a channel, you need the GuildChannelManager of a guild. To get this, you need to call the Guild.channels property. Instead you have .channel without the s at the end. Try using .get('<id>').channels.create and see how that works.
Related
If the user has already given me his name in entirely different intent, I store it in my DB.
However I need to request it again in another intent where webhook slot filling is enabled and given_name is a required value.
But if he has already given it to me, then there is no need to ask, so I want to grab the stored name in DB and fill the parameter (given_name) with this value, so I don't need to ask
How can I do this? Can I directly alter parameter values with my webhook?
Wouldn't it be possible to call you DB instead of using the parameter values?
If your database returns a name, you know that your user has mentioned a name in a previous intent before. From there you can just use the response from your database. If your database doesn't send back a name, then you would know when to ask your user about their name.
A simple example of this would be:
async function handleUsername(agent) {
// Check if the user has mentioned a name before in your DB.
const username = await callDatabase();
if (!userName) {
// Ask the user for their name.
}
// Continue the conversation.
}
Note: Since you mentioned that you are checking if the user had mentioned their name in multiple intents, it would nice to re-use the handleUsername() function across your webhook, if possible.
What I want to do: Check if a user is following another user. Basically I want to see if the UID of the user is in the "follower" array in the document of the other user-profile.
I thought of the option to use the .whereField command, but then I would get more documents and not only the one that I care of.
You can go with array-contains operator:
https://firebase.google.com/docs/firestore/query-data/queries#array_membership
So you can write something like this:
usersRef
.whereField("followers", arrayContains: "l47GVBdjsabjdjds")
Get the user document (using whereField isEqualTo)and check if the followers field array contains the uid of the second user.
I tried lots of differents ways but didn't worked, I know it requieres
Channel
Id
And the method that is .delete()
Using permissionOverwrites
Couldn't get the correct order to use it.
You can do:
channel.permissionOverwrites.get('member ID').delete();
I'm trying to limit a command to only #Narrator users, nothing I have seen works, always throw
TypeError: message.member.roles.has is not a function //Have tried by id and name, nothing works
I've used with .has .find .some and many different methods
Since discord.js v12 you need to use the cache property to access a GuildMember's roles
message.member.roles.cache.has()
QBO raises the error code 2250 "You must fill out at least one split line". Why does it need to pass a line for deleting an invoice? Should it just require invoice.id?
For whatever bizarre reason, the Intuit v3 "delete" call requires that you pass the entire invoice object to the delete call in order to delete an invoice.
It's weird, yes. Unfortunately, it's also the way the API works and is required.
You can see this documented here:
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/010_calling_data_services/060_delete
Quoting:
The request body includes the full payload of the object as returned in a read response.
I figured a hack way without submitting the entire object. It accepts an empty line and sync token along with the invoice id.