Discord WebHook Bot

Approved Discord WebHook Bot 1.0.2

No permission to download
Overall code seems fine, and safe. Approved.

I suggest to use threading when doing web requests, because It will hold down the main thread, and will cause the server to lagg sometimes.
(I know, the wiki is down.)

Python:
Loom.ExecuteInBiggerStackThread(lambda:
    WebHook.execute()
)
 
  • Like
Reactions: SPooCK
Overall code seems fine, and safe. Approved.

I suggest to use threading when doing web requests, because It will hold down the main thread, and will cause the server to lagg sometimes.
(I know, the wiki is down.)

Python:
Loom.ExecuteInBiggerStackThread(lambda:
    WebHook.execute()
)
Noted. Just warming up to the old Legacy development. :p I would have preferred doing it in C#, but since its not yet supported for dynamic reloading, a small plugin like this, I would think it's better left in Python for now.
 
  • Like
Reactions: DreTaX
You actually put the handling in a sub thread ^^
The Fougerite system now shows if something takes very long to call.

The page just explains that there are functions that must be called on the main thread.
 
You actually put the handling in a sub thread ^^
The Fougerite system now shows if something takes very long to call.

The page just explains that there are functions that must be called on the main thread.
Well, as long its put in the right place, I'm happy enough. Too much of a headache knowing the right methodology, main thread, sub thread... :rolleyes:
 
Could I get some help setup, I think i've done everything right but it seems to not work for me.
my server runs the laters fougerite and RB.

in Pyplugins i put the DiscordBot folder containing the .py and the settings.ini.

heres my INI:
[Settings]
JoinName=[Player Connected]
LeaveName=[Player Disconnected]
ChatName=[Rust Chat]
JoinLog=true
LeaveLog=true
ChatLog=true
JoinMessage={PlayerName} joined the server.
LeaveMessage={PlayerName} left the server.

[Webhooks]
JoinHook=https://discordapp.com/api/webhooks...g5VwNRFFiDAsN97nlojByCPhaVVXCjC5Wz0iGMrBOH***
LeaveHook=https://discordapp.com/api/webhooks...6AESSYtRvRB90XpCAxgrw9oETia7MPu3eaE-yza4-lf**
ChatHook=https://discordapp.com/api/webhooks...tBsWbriYDOar85-ciRHQTI8-s8wRKHMojBiV7SliI****

changed the last few letters with stars.

When i load the server in the command it says it runs.

On my discord Ive got the 3 hooks running tied to a channel... and I dont get updates!

Edit: Just Cheked my logs I see : [Error] [Discord Bot]: There was an Web.POST error [1]
 
Last edited:
You BOT needs to be in your Discord Server in which you want to send messages from, otherwise it will not work.
 
You BOT needs to be in your Discord Server in which you want to send messages from, otherwise it will not work.
So its not webhooks in the channel then? it requires an actual bot??

Could you come talk to me on the discord app please?

Edit: I Tested the webhooks from a website webhook tester :
 

Attachments

  • testbot.png
    testbot.png
    10.2 KB · Views: 20
Last edited:
I got confused with another Discord, bot I got on my PC, so don't mind my last message.

You don't actually need a bot to use the Webhooks, but a proper configuration of them, and if you tested them outside the plugin and if they work, then they should work fine within the config of the plugin.

Maybe you're not installing it properly, do you see any errors and does it even load properly in your game?

It's been an 1 year since I made this, I totally forgot how it works. Sorry... o_O
 
yes it says it loads, but as soon as the webhook is "triggered", it gives [Error] [Discord Bot]: There was an Web.POST error [1]. Everytime someone talks or logs in logs off it says [Error] [Discord Bot]: There was an Web.POST error [1] . The ini is setup properlly and is right next to the plugin ( i let the plugin create the ini, then modified it as you seen a few more post up. If you'd like I could send you the webhooks directly, but like i said ive tested them, so i'm lost...
 
There seems to be a problem with Web. POST Fougerite method going through Python for some reason, in this case, cause I can't seem to find any proper solution, the plugin needs to be rewritten in C#, if I ever get the time to do that...

Really don't know what may have broken within Fougerite updates recently...
 
There seems to be a problem with Web. POST Fougerite method going through Python for some reason, in this case, cause I can't seem to find any proper solution, the plugin needs to be rewritten in C#, if I ever get the time to do that...

Really don't know what may have broken within Fougerite updates recently...
Well It wasn't really Fougerite, but the TLS encryptions, and new SSL certs. The compatibility is fixed in 1.8.0 by upgrading some native dlls, and extending mono.