discord.collection is not a constructor - discord.js

I'm trying to write a discord bot and am constantly getting this error whenever i try to run it.
TypeError: discord.collection is not a constructor
It's from this line of code
bot.commands = new discord.collection();
I'm not the best at JavaScript and have looked around google and can't find anything that matches my exact issue, all the ones I find have the same error but are something completely different.
whether or not this command is outdated or no longer in use I am unsure of but any help would be greatly appreciated!

It's Collection, not collection. The standard for naming classes is always first letter capitalized.

Related

React seems to be mangling variable names and then complaining they don't exist

Over the weekend, this bug (see attached image) appears to have crept in, I'm thinkning it was a dependency update, since the variable it's complaining about "_onAssign" does not appear once in the entire code base and the actual variable "onAssign" is defined in every case I have tested.
Is this a known result from something could I have done? (I'm still quite new to javascript and front end development, so that is enitirely possible)
extra note, this is not new code, and was working up until Friday evening, now all our builds are failing with this exact error.
_onAssign is not used anywhere, in any of our files, so it is rightly undefined. I would like to call the function onAssign
You need to console log that function and comment the whole other code so you won't get any error then see what it logs in the console and from there you can find out what is causing the error .

Discord.py reacting to most recent message

I need help reacting to the most recent message. This can be in a specified channel or just in the server. The main thing I need help with is getting the message id or info about the most recent message, the reacting part I can do.
Please let me know if there is a solution, as everything I have looked up hasnt produced any results.
Thanks!
There are quite a few methods to get the last message in a channel. Assuming you already have a specific channel in which you want to react. Use
last_message = channel.last_message #channel must be a discord.Channel
The docs specify that this could sometimes get the wrong message, hence we use
messages = await channel.history(limit=1).flatten()[0]
References:
last_message
history
Tip:
Try searching for the relevant class in the docs instead of googling

Why is my kick command not working? (discord.js)

I've tried using a command handler and the other commands work fine. It's just the kick command that doesn't, can anyone help? https://sourceb.in/8d4f78e43a is the code, thanks!
Since the code is pretty small, you should post it on SO instead of an external link, for archiving for the future and some other reasons you can look up
Also you should mention if you get any error logs, in this case I don't think you would have
The issue is let member = message.guild.members.cache.get(args);
You are passing in an the array args, not a string (which <Collection>.get() requires, you probably meant args[1]:
let member = message.guild.members.cache.get(args[1]);

Trouble with Rails array methods

I have a block of deprecated Ruby on Rails code which is the beginning of a rake file and doesn't depend on anything except accessing the Protein class, which it can (inherited from an earlier version of the project)
task :import_merops_cleavages do
require "#{Rails.root}/config/environment"
require 'bio'
require 'merops'
require_relative '../../app/models/protein.rb'
proteases = Protein.includes(:drs).map(&:drs).where(db_name: 'MEROPS').uniq
#total = proteases.count
puts "starting import of #{#total} proteases"
#added = 1
#padded =1
Every time I try to rake this particular task, the rake aborts and I get the same error message
NoMethodError: undefined method where for #<Array:0x00007f88a625d290> Did you mean? when
I have tried to use other methods to get rid of the where or rearrange things but keep the logic the same, but am at a loss. If anyone has an idea how to resolve this, I would be very grateful
Edit: this is the main visual relational documentation for the application, but I can explain anything that may not make sense.
The error is correct, the where method is not available on Arrays.
It can only be used on rails models.
The map method returns an array, so I reckon you're issue is there.. try removing the .map and see if that solves this issue.
So I'd imagine something like this might work:
proteases = Protein.all.where(db_name: 'MEROPS').uniq
Tell us more about what Protein is.. better yet share the code for it.

How do i set a watch on an object in ceph?

I am trying to keep a watch on an object in Ceph, but I don't know how to do it. I searched for examples online but could not find any. Found some documentation here. It says that I can use rados_watch to watch an object for changes. But I dont know how to implement it in C, especially the rados_watchcb_t part. It says rados_watchcb_t would contain the action to execute on notification. How do I declare it?
This is what I tried:
rados_watchcb_t rados_watch = printf("Updated");
But this gives an error.

Resources