Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Logi czatu Jaruna
- // @version 1.0
- // @description Zapisuje mi na diskordzie logi z czatu.
- // @author Adison
- // @match http://zemyna.margonem.pl/
- // @grant none
- // ==/UserScript==
- (function(webhook_url){
- function sendToDiscord(nick, txt, option){
- switch(option){
- case 0:
- txt = "O " + "«**" + nick + "**»" + "(" + ut_time(unix_time()) + ") " + txt;
- break;
- case 1:
- txt = "K " + "«**" + nick + "**»" + "(" + ut_time(unix_time()) + ") " + txt;
- break;
- case 2:
- txt = "G " + "«**" + nick + "**»" + "(" + ut_time(unix_time()) + ") " + txt;
- break;
- case 3:
- txt = "```«" + nick + "»" + "(" + ut_time(unix_time()) + ") " + txt + "```";
- break;
- }
- $.ajax({
- data: JSON.stringify({
- "content": txt,
- }),
- dataType: 'json',
- processData: false,
- type: 'POST',
- url: webhook_url,
- });
- }
- g.chat.parsers.push(function(ch) {
- let tmpnick = "";
- if(ts() / 1000 - ch.ts <= 2 && ch.n != ""){
- tmpnick = ch.n;
- if(ch.k == 3){
- tmpnick = `${ch.n} -> ${ch.nd}`;
- }
- sendToDiscord(tmpnick, ch.t, parseInt(ch.k));
- }
- })
- })("https://discordapp.com/api/webhooks/636257741807026216/LtP2pBFIQ65yIrZ5XYrPdc8dTyJf40YiahIO8z0ftJlRD7ORJgLt2dJkFq5VkHVUdNPY")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement