Making my first script in Discord [Help]


I don’t know what I am doing wrong but I am trying to make a script so it send a text with the attachment.

MikuKiss.js (542 Bytes)


One issue is you’re registering a discord command but then using the twitch command event.

Change this:

$.bind('command', function(event) {

to this:

$.bind('discordChannelCommand', function(event) {


I fixed that but still can’t get the command itself to work and module loads also fixed my syntax errors on line 14 and 15


You should put the command as all lower case, and you don’t need the if statement that’s checking if the action or subAction is undefined.

As for the syntax errors, you have an ending parenthesis tag where it should be an ending brace.

Where is this script file located? You should place it in /YourBotFolder/scripts/custom/discord/commands/MikuKiss.js

You’ll have to make the custom folder and the sub folders. But this way when the bot gets updated all you have to do is copy the custom folder, and not dig around for all your custom scripts.

Something like this (in the directory I noted above) should work:

(function() {
	$.bind('discordChannelCommand', function(event) {
		var channel = event.getChannel(),
			command = event.getCommand(),
			args = event.getArgs();
		if 	(command.equalsIgnoreCase('mikukiss')) {
			$.discord.say("Miku Is Kissing You");
			$.discord.say("(file MikuKiss.gif)");
	$.bind('initReady', function() {
		$.discord.registerCommand('./custom/discord/commands/MikuKiss.js', 'mikukiss', 0);


now I can use !mikukiss but I am getting init.js:308 (, discordChannelCommand, (./custom/discord/commands/mikukis.js) Reference Error: “event” is not defined.


You are not defining event anywhere above. Your $.bind call is missing event as a parameter to the function:

$.bind('discordChannelCommand', function(event) {

You had it in your first iteration above, the example above is just missing it.


Got my script working thanks :slight_smile: