Discord WebHook Bot

Approved Discord WebHook Bot 1.0.1

No permission to download

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
3,984
1,905
113
At your house.
github.com
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

SPooCK

Plugin Developer
Plugin Developer
Jul 27, 2014
18
36
13
27
England / Bulgarian
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

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
3,984
1,905
113
At your house.
github.com
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.
 

SPooCK

Plugin Developer
Plugin Developer
Jul 27, 2014
18
36
13
27
England / Bulgarian
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:
 

Schmurtz

New Member
Trusted Member
Member
Mar 29, 2020
9
1
1
Canada
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/696213518101512234/BOfoi48823mhi2t0P-h39UJg5VwNRFFiDAsN97nlojByCPhaVVXCjC5Wz0iGMrBOH***
LeaveHook=https://discordapp.com/api/webhooks/696213747446055013/EKexU67C8mWAeWLTClqPx6AESSYtRvRB90XpCAxgrw9oETia7MPu3eaE-yza4-lf**
ChatHook=https://discordapp.com/api/webhooks/696213840593027163/SYZgxFoeI9NHblhsaOYk5bktBsWbriYDOar85-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:

Schmurtz

New Member
Trusted Member
Member
Mar 29, 2020
9
1
1
Canada
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

Last edited:

SPooCK

Plugin Developer
Plugin Developer
Jul 27, 2014
18
36
13
27
England / Bulgarian
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
 

Schmurtz

New Member
Trusted Member
Member
Mar 29, 2020
9
1
1
Canada
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...
 

SPooCK

Plugin Developer
Plugin Developer
Jul 27, 2014
18
36
13
27
England / Bulgarian
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...