samp.directory
← Skrypty i biblioteki

AliLogic/discord-command

My own discord command processor alternative, based on iZCMD-like functionality. So good that people started to copy paste mine.

Biblioteka★ 4zaktualizowano maj 2021Brak licencjiPawnsampctl
Otwórz na GitHubie

To repozytorium nie ma pliku licencji. Jest publiczne do odczytu, ale samo to nie daje pozwolenia na ponowne użycie.

Zainstaluj za pomocą sampctl

sampctl package install AliLogic/discord-command

Uruchom to w folderze swojego projektu. sampctl pobiera pakiet i to, od czego zależy.

Wypróbuj w kompilatorze Pawn →

Dodaje jej pliki include, razem z bibliotekami, od których zależy, do kompilatora Pawn w twojej przeglądarce, gotowe do dołączenia w skrypcie.

Zależy od 3 pakietów

README.md

discord-command

My own discord command processor alternative, based on iZCMD-like code and functionality.

Why this?

  • Works in nicely with your pre-existing code, thanks to ALS Hooking.
  • Full control over the command message, delete, get the channel id, author etc.
  • All commands are case insensitive.
  • Optional event if you want to send users a message if their command failed or not.
  • Written nicely (yes!)

Requirements:

  • Discord Connector (@maddinat0r)
  • SSCANF (@Y-Less)
Version: 0.4.0

Installation

Simply install to your project:

sampctl package install AliLogic/discord-command

Include in your code and begin using the library:

#include <discord-command>

Usage

new
	DCC_Channel: gCommandChannel
;

public OnGameModeInit() {
	gCommandChannel = DCC_FindChannelById("channel-id-here");
}

DISCORD:stats(DCC_Message: message, DCC_User: author, params[]) {

	new
		DCC_Channel: channel
	;

	DCC_GetMessageChannel(message, channel);

	if (channel != gCommandChannel) {
		return 1;
	}

	new
		name[MAX_PLAYER_NAME]
	;

	if (sscanf(params, "s[24]", name)) {
		return DCC_SendChannelMessage(channel, ":warning: You must provide name of the player.");
	}

	// Do something here

	return 1;
}

public OnDiscordCommandPerformed(DCC_Message: message, bool: success) {

	if (!success) {
		new
			DCC_Channel: channel
		;
		
		DCC_GetMessageChannel(message, channel);
		return DCC_SendChannelMessage(channel, ":x: The command entered doesn't exist.");
	}

	return 1;
}

dependencydiscord-commandpawnpawn-packagesa-mpsampctl

Ta strona jest zbudowana z tego, co GitHub publikuje o repozytorium. samp.directory nie hostuje kodu. Zgłoś problem z tym wpisem

AliLogic/discord-command: Biblioteka SA-MP | samp.directory