Closed mrc4tt closed 4 years ago
@MoritzLoewenstein ^^ I hope you're getting the message now, without I need to close again :D
Yes, this is possible, I already did this for a few discord servers. You need to create a webhook in the channel and use sourcemod_discord (on my github). Its 3 lines of code which you can copy from the readme and recompile the plugin.
Is it possible, to make.. so it's work for diff discord servers + which channel it should post message per .cfg file? or do I need to edit the .sp file for each discord server?
@MoritzLoewenstein
so I need to place it, like this?
public UploadComplete(const String:sTarget[], const String:sLocalFile[], const String:sRemoteFile[], iErrorCode, any:data) {
if(iErrorCode == 0 && g_bDelete) {
DeleteFile(sLocalFile);
if(StrEqual(sLocalFile[strlen(sLocalFile)-4], ".bz2")) {
new String:sLocalNoCompressFile[PLATFORM_MAX_PATH];
strcopy(sLocalNoCompressFile, strlen(sLocalFile)-3, sLocalFile);
DeleteFile(sLocalNoCompressFile);
}
}
if(iErrorCode == 0) PrintToChatAll("[SourceTV] Demo uploaded successfully")`
Discord_SendMessage(DISCORD_WEBHOOK, or somehow.
I'm not expert with scripting! =) so that's why I offer $ via PayPal!
You want just the "upload completed" message or also the download link? I dont do paypal work but maybe I can put it up on github for everyone since a few people asked me about this.
Both. message + download link. =)
It could be pretty nice.
Let me know, once it's fixed! =D @MoritzLoewenstein
It should be possible now, you have to set these two options:
sm_teasyftp_discord_webhook <your_discord_webhook>
sm_teasyftp_announce_on_discord 1
ping @MikkelDK
I will check! ;)
@MoritzLoewenstein
Do I need to use https? Seems I getting this:
] rcon sm_teasyftp_discord_webhook
"sm_teasyftp_discord_webhook" = "https:" ( def. "" )
L 06/01/2020 - 20:07:58: [discord.smx] [OnRequestComplete] Request failed
Fixed with adding "link" on server.cfg Seems work =D [20:15] DEMOBOT: de_dust2: http://secretlink/SuckerPunch/test1337.dem
Is it possible to adding Servername? Example:
Format(sDownloadURL, sizeof(sDownloadURL), "%hostname - Map: %s: http://%s", sCurrentMap, sDownloadURL);
You can have different directories for each server (on the upload server) and then you see it in the download url, or you can make different channels and use a different webhook url for each server.
Maybe I will add an option, since this generally works I will close this issue for now.
Edit: You can add multiple webhooks to a single channel, so you could name the webhook like the hostname.
@MoritzLoewenstein Thank you for your help! =)
I was thinking, about it's possible the "Format" can understand "Hostname" field from server.cfg
Format(sDownloadURL, sizeof(sDownloadURL), "%hostname% - Map: %s Download: http://%s", sCurrentMap, sDownloadURL);
So its output: MikkelDK Server - Map: de_dust2 >> Download: http://mikkeldk.blabla.org/demo.dem
If you change something in this file it will not change anything, maybe I will add this option.
If you change something in this file it will not change anything, maybe I will add this option.
@MoritzLoewenstein I did try this: - without response!
decl String:ServerName[64];
new Handle:convar = FindConVar("hostname");
GetConVarString( convar, ServerName, sizeof(ServerName));
Format(sFtpURL, sizeof(sFtpURL), "ftp://%s:%s@%s:%i%s%s", sUser, sPassword, sHost, iPort, sForcePath, sRemoteFile);
Format(sDownloadURL, sizeof(sDownloadURL), "%s/%s%s%s", sHost, sUser, sForcePath, sRemoteFile);
if (GetConVarBool(g_hCvarAnnounceOnDiscord)) {
GetConVarString(g_hCvarDiscordWebhook, g_sDiscordWebhook, sizeof(g_sDiscordWebhook));
GetCurrentMap(sCurrentMap, sizeof(sCurrentMap));
Format(ServerName, sizeof(ServerName), sDownloadURL, sizeof(sDownloadURL), "%s - Map: %s >> Download: http://%s ", ServerName, sCurrentMap, sDownloadURL);
Discord_SendMessage(g_sDiscordWebhook, sDownloadURL);
}
as i said, it doesnt make any difference if you change something in this file.
to format the message the way you want, use:
sm_teasyftp_announce_format "%host - Map: %map >> Download: %dl_url"
as i said, it doesnt make any difference if you change something in this file. to format the message the way you want, use:
sm_teasyftp_announce_format "%host - Map: %map >> Download: %dl_url"
Little error: It doesn't incl http:// (Example!)
I see you did update. thanks anyway <3
fixed, gn8
stop replying to closed issues. user is required because your ftp host needs to know which user account the file is in.
Hi,
It could be nice if it's possible to make;
So example this:
So it's possible to make a little plugin, so it will "chat" to specific room on Discord, with this text: "[SourceTV] Demo uploaded successfully" - without its need to post in-game of the gameserver.
Do you think it's possible? - if we can talk about it, about I can contact you private with a little offer cash?