Comparing role positions - discord.js

Can someone help me?
ERROR: Cannot read property ‘comparePositionTo’ of undefined
Code:
if(message.member.roles.highest.comparePositionTo(message.mentions.members.first().roles.highest) < 1)

Your actual line of code in hastebin has comparePositionsTo instead of comparePositionTo, which is undefined.
The error you gave means that the user that sent the message has no roles.
Also, I highly recommend you do check if the mention is defined or not in your code.
And a 3rd thing - in v12, it's Discord.MessageEmbed(), not Discord.RichEmbed().
Hope this helps!
(sidenote - in the future you should probably copypaste the line of code in question into SO instead of rewriting).

Related

Error on one page that does not appear anywhere else

Hi so my wordpress site has just started acting up, I am not sure if its an update that has caused this but only on this one page I am getting this error regarding
Notice: Array to string conversion in /customers/c/1/7/veganantics.co.uk/httpd.www/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/Schemas/ImageAttachmentSchema.php on line 95
I can't seem to find the issue, I have tried replacing the file with a new core file and the error is still there, would really appreciate some help
This is the page: https://veganantics.co.uk/vegan-gifts/
Thank you
Ash
The theme, a plugin or some custom code is probably using the wp_calculate_image_sizes filter and returning an array instead of a string.
Do a text search on your install and look for wp_calculate_image_sizes. The function that you need to find will look similar to
add_filter('wp_calculate_image_sizes', 'something');
Explanation:
ImageAttachmentSchema.php on line 95 is calling wp_get_attachment_image_sizes which must be a string.
wp_get_attachment_image_sizes is returning wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id ) which again must be a string.
wp_calculate_image_sizes returns a filtered value, and that's the only place where such an error (array instead of a string) can happen. So, if the filter incorrectly returns an array, it bubbles up to the function that you see in the error log.

How to use the .addField without the second comment in discord.js

So it's pretty simple. I just don't want the second comment of .addField eg.
.addField(advice.slip.advice)
but it keeps on showing undefined for the second comment...
You need to provide something as a value in a field, otherwise it will be undefined. But for your example you can just make:
.setDescription(`**${advice.slip.advice}**`)

Edit/Insert mode error: Directly after tblbookings.edit

I'm working on my end year project for high school and this problem came up. This code is supposed to filter the database and only work on the data whose ID is bigger than intGroep2 (which is at this point 22). Then it must change the first row's 'pop' column to the value of cb501pop1.checked.
tblbookings.Open;
tblbookings.Edit;
tblbookings['pop'].edit;
tblbookings.filter := 'ID >= '+ inttostr(intGroep2);
tblbookings.filtered := true;
tblbookings.First;
tblbookings['pop'] := cb501pop1.Checked;
The problem arises with the following line:
tblbookings['pop'].edit;
If it is not there, the program gives me an error: 'dataset not in edit or insert mode.' And if it is there it gives me an 'invalid variant operation' error. One other question said to change "edit" to append, but it still gave the same error. Another question suggested that somebody posted already, which I didn't. Nowhere in my code is 'post'. This is supposed to be an easy answer and thus should only be practicing the basics. 'Afterscroll' and other stuff mentioned in other questions isn't supposed to be in the solution since we didn't learn it yet.
Thank you.
EDIT: tblbookings.fieldbyname('pop').edit; gives an error: missing operator.

Accessing objects in an array

Newbie here! This is actually an update to this issue; I'm attempting to access a specific element, hoping someone can help me. I'll include the code and what it logs to the console:
console.log(nextProps.filterSliderApplied);
what is logged to the console
What I'm trying to reference, even with just a print to the console, are currentVal, min, or max (so 20, 2, or 177932, respectively) . I've tried using various Objects methods, but I can't seem to isolate the individual elements. Any direction would really be appreciated. Thank you!!
I actually figured this out quite some time ago and forgot to post an answer; basically, i needed to reference the key:
<Slider
defaultValue={filterSliderApplied[key].currentVal}
min={filterSliderApplied[key].min}
max={filterSliderApplied[key].max}
/>
There's a lot of other code involved, but this allowed me to directly access each value I was trying to target.

I started to using mothur version - v.1.36.1-, but I got some error messages (shown below). How I can overcome this?

I start the Mothur Tutorial (https://www.mothur.org/wiki/MiSeq_SOP). But from the beginning, I got some error messages when I create " make.file "in mothur*(Error commands are shown below). I changed parameters but the result was negative. How can I solve this problem?
****mothur > make.file(inputdir=MiSeq_SOP, type=fastq, prefix=stability)
Setting input directory to: MiSeq_SOP/
prefix is not a valid parameter.
The valid parameters are: type, seed, inputdir, and outputdir.
[ERROR]: did not complete make.file.****
Actually, the prefix parameter is a valid parameter in mothur. Personally, I have never encountered a problem with using a prefix for the make.file command, but your command should be valid.
You could test if your inputdir is specified correctly (the mothur error and warning messages are not necessarily the most clear ones). If this works as well, I suggest that you well document this behaviour and send it to the mothur team (in my experience, they are quite responsive and ready to help).

Resources