Client.spread() - shysolocup/noscord.js GitHub Wiki

spreads out data over another directory if you want to have commands in a separate folder

spread tasks are stored in Client.spreads and they're ran when the client logs in

Function Sync

Arguments:

  • directory String
    directory you want to spread to

  • ?data Array
    arguments you want to spread with it
    defaults to just the client if not given

  • ?ignore Array
    files to ignore in the directory
    automatically contains index.js and index.ts

  • ?action Function
    what the spread does internally with the stuff
    don't change if you don't know what you're doing



JS (index.js)
client.spread("src/commands");                     
JS (src/commands/ping.js)
module.exports = (client) => {	

    client.import("commands", "app", "components");

    commands.create("ping", "replies with pong", (ctx) => {
	let timestamp = new Timestamp();

	let embed = new Embed({
		header: "Pong!",
		timestamp: timestamp.embed,
		color: app.colors.blurple,
		footer: `latency: ${timestamp.latency(ctx)}ms`
	});

	ctx.reply({ embeds: [embed] });
    });
	
}


⚠️ **GitHub.com Fallback** ⚠️