I don't know if it's possible but I need help!
So, each member has picked a role with the Carlbot:s reaction-role...
**I want to make a button in a channel that sends a message to other members with the SAME ROLE as the person who pressed it. **
(it would be absolutely fantastico if they couldn't write in the chat/channel. The only way they can interact is via the button.)*
Thanks in advance!
//Grenmyr
I've tried to create a webhook linked with zapier. But it can't read the pressers role(roles).
Related
Is there any way to properly save a user's role history without the need for a database and/or a JSON file on Discord.js? I would like to create a function that logs the roles a user has at the beginning of the command and gives them back after a specific function is triggered.
There is an easy way to save a user's Role history on Discord without the need for a Database and/or any JSON file, you must add a few lines to your code in order to do this.
You first need to make sure your Discord bot has "Privileged Gateway Intents" enabled within the Discord Developer Portal panel, this will highly improve the accuracy of the bot's cache fetching tasks. Next, create a constant for the user mention or user ID, just like the following:
const saveRolesFor = (message.mentions.members.first() || message.guild.members.cache.get(args[0]));
With these 2 arguments, you will be able to state the id of the user or mention the user instead.
Then you must save the roles for the specified user inside another constant variable, just like the following:
const roleHistory = saveRolesFor.roles.cache.map(r => r.id);
The reason why mapping the roles is the best thing to do is due to the roles cache containing other elements, aside from the actual user roles, mapping them would simply include the actual roles of the user, preventing potential issues.
Now you must state the new role you'd like the user to have, just like the following:
let roleToAdd = message.guild.roles.cache.find(r => r.name === 'Role');
Time to remove all of the previous roles and add the roleToAdd to the user, you should do it as:
await(saveRolesFor.roles.set([roleToAdd.id]));
You will want to set the user's roles, as this function automatically removes any other role the user had, and add the single role you have stated, you no longer require the .remove and .add functions.
After these functions have been performed, you can be creative and add the rolehistory back after certain functions are completed.
A very simple example of this would be to add the roles back to the user once a message is sent, for example:
message.channel.send(`The roles for ${saveRolesFor} have been added back!`)
.then(saveRolesFor.roles.set(roleHistory));
All of the user's previous roles will be added successfully, and the roleToAdd will be removed, as you .set the roleHistory of the user, meaning you added those specific roles only. The .then function is calling the roleHistory set after the message is sent to the channel, you could modify it to properly fit into what you attempt to obtain out of your code.
This won't be the best way to add the roles back, as it will take less than a second, but the functions shown above will be highly useful at the time of creating a similar command.
Hope it was helpful!
So im working on a discord bot, and working on a command where it mentions a user. For example: -fakekick #user and the bot would say User has been kicked I've read through the docs and found a few sites but I couldn't really understand it as I just started discord js a few days ago. Thanks
To get the user object of a mentioned user, you can very simply use the mentions extension of the message object. We can very simply use it in order to define our user, and later on, mention him in a future message. That can be done very simply as so:
const user = message.mentions.users.first(); // Would get the first mentioned user's object
message.channel.send(`${user} has been kicked!`); // To mention a user, you simply need to mention his user object.
Since I start working on MSGraph to extract all the meeting history data. I asked what's the best way. Now I know:
List events does not support parameter of date range, so I cannot use
it.
getSchedule has bug of odata.nextLink, I already file
ticket.
Now I like to try calendarView. calendarView only related to the login account, e.g. I
login as A, if meeting room account B have a meeting not related to
A, then calendarView will not get it. so I'm thinking, if I share B
to A, then I can use
https://graph.microsoft.com/v1.0/users/{accountB}/calendarView?startDateTime=...
to get the data.
I tested it, but got error message:
{"code":"ErrorItemNotFound","message":"The specified object was not found in the store."}
what could be wrong?
If i want to access the shared mailbox using Microsoft graph, i would try this:
GET graph.microsoft.com/v1.0/users{Alex-userId | Alex-userPrincipalName}/calendar/events
Please note that the sharing permissions (Calendars.Read.Shared or Calendars.ReadWrite.Shared) allow you to read or write events in a shared or delegated calendar. Before that i will make sure i have the enough permissions and follow the documentation.
Hi,
I'm trying to create a lightning component to add records to the campaign object and I keepo getting an error message that I can't seem to find sufficient information on.
I'm using the lightning:recordEditForm component and because it automatically generates the picklist or input field based on the field data type and doesn't need a controller.
Here is the code I have written.
When I try to add the component to the appropriate page I get the error message shown in red.
Has anyone else solved a similar problem?
I'm inclined to believe it's a permissions issue but I'm not sure. If there's any more information I can give let me know.
I would really appreciate some assistance.
Thank you
Make Sure that your Profile has all necessary Object Permissions for Campaign Object.
For Campaigns: check if you have enabled "Marketing User" checkbox in the relevant User's profile.
This is one of annoying Salesforce Gotchas.
Check whether the user has access to create the record.
Try checking it in Profiles --> Campaign --> make sure Read, Create, Edit are checked (True)
Also make sure you have enabled Marketing User (Setup --> Users)
I have a Profile Type attached to a user. In there I have a Entity Reference Field of Program Manager. I have Live Events(content-type) that people can register for. I set up a Rule to Email the Program Manager every time someone registers.
My problem is I am trying to pull information from the Profile based on the the entity reference for the Program Manager.
I have the field printing out by using this pattern...
[registration:entity:field_program_manager]
However when I try to pull the first name, email of phone I can not get it to show up.
Does anyone have any ideas to share?
Many Thanks!
Okay so I was trying to solve for sending the email to the Author of the page but was having issues. So I created a new fields hoping it would be easier. In trying to solve for this I solved the original issue.
To print the Author of a node to an email through Rules actions us this.
[registration:entity:author]
So for first name it would be:
[registration:entity:author:profile-main:field_first_name]
Hope it helps someone else.
If you're using entityform instead of a node and referencing the default user info (not the 'Main Profile' profile type), then you want to use something like
[entityform:field-staff-entity-ref:field-work-email]
In this case, 'field-staff-entity-ref' is the entity reference field in the entityform and 'field-work-email' is the field in the user's account settings.