[[+content_image]]
G
G
getaxe2022-03-06 00:55:59
JavaScript
getaxe, 2022-03-06 00:55:59

How can I add a function to the class so that I can use "this."?

I need to add a file with my functions to class bot: and call them with: 1) The bot is a 100% class 2) It has functions already written by the creators of discord (which are in [[Prototype]]) Maybe you can just put them in a regular prototype without these brackets or is there any way to fit them into an existing one?
const bot = new Discord.Client(config.cfg);
bot.funcname(args);

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
A
Aetae, 2022-03-06
@getaxe

Normally:

Discord.Client.prototype.funcname = function(arg) { ...};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question