Huskehhh / dayz-monitor

DayZ server monitoring discord bot
6 stars 0 forks source link

dynamic ip = dynamic BATTLEMETRICS_SERVER_ID #2

Closed Tesch1933 closed 3 years ago

Tesch1933 commented 3 years ago

First of all....wow, great, worked immediately! Thank you soooo much!!

I have a question... My IP changes every day, so my "BATTLEMETRICS_SERVER_ID" changes also every day Do you have an idea how to solve this?

for example, i found a small BOT which outputs the search result via a fixed link at battlemetrics.com. and it works. But the bot is written for the messenger Telegram :-(

the search requires that the server is online. If it is not, it does not appear in the search, which is interpreted as "offline".

Example link: https://www.battlemetrics.com/servers/dayz?q=%22PVP|PVE|BaseBuilding%2B|Vehicle%2B|Loot%2B|Day-1h|Night-5min%22&status=online&sort=score

Thank you!

Huskehhh commented 3 years ago

Hey mate.

Yeah I can probably look into providing a build for you that will auto-update the server ID, I'm fairly busy but when I get a chance I'll look at the battle metrics api again and see what I can come up with!

Cheers

Tesch1933 commented 3 years ago

That's really nice! I'm really excited and look forward to hearing from you!

Huskehhh commented 3 years ago

Found some time tonight to hop on this and throw it in. I haven't had a chance to test it, so if you have a spare moment that would be awesome!

Usage:

git clone https://github.com/Huskehhh/dayz-monitor
cd dayz-monitor
git checkout dynamic-id

Following the regular steps in the README with one extra step: Set BATTLEMETRICS_SEARCH as PVP|PVE|BaseBuilding+|Vehicle+|Loot+|Day-1h|Night-5min in your .env

Should also remove BATTLEMETRICS_SERVER_ID as it's not relevant in your case!

Looking forward to hearing how you go!

Edit -- added cd step

Tesch1933 commented 3 years ago

wow thank you. that was fast! with the second command ("git checkout dynamic-id") i get this error message: "fatal: not a git repository (or any of the parent directories): .git"

Huskehhh commented 3 years ago

wow thank you. that was fast! with the second command ("git checkout dynamic-id") i get this error message: "fatal: not a git repository (or any of the parent directories): .git"

No problems! Apologies. You will need to run cd dayz-monitor after cloning the repo - and then try the checkout.

Tesch1933 commented 3 years ago

wow! i am impressed! it worked. i get an errer message, but the bot works fine. the last line says: Error when updating cache: Missing Permissions

Huskehhh commented 3 years ago

wow! i am impressed! it worked. i get an errer message, but the bot works fine. the last line says: Error when updating cache: Missing Permissions

Awesome, glad to hear it! :) I believe that issue comes from the bot lacking the correct permission to update the channel name

Tesch1933 commented 3 years ago

Awesome, glad to hear it! :) I believe that issue comes from the bot lacking the correct permission to update the channel name

ok. I will check that.

perhaps another idea. But I can not estimate how difficult it is to implement, and the bot is good enough :-) Many players search for the server via the IP address. Since it is dynamic in this case, an additional query would be super handy. For example via the query: " !ip " The bot would then respond with: "ip:95.116.12.111"

ps. i have tucked it away correctly, haven't i? The BOT only responds to requests or can it also write something independently? for example, when the number of players changes.

Huskehhh commented 3 years ago

Awesome, glad to hear it! :)

I believe that issue comes from the bot lacking the correct permission to update the channel name

ok. I will check that.

perhaps another idea.

But I can not estimate how difficult it is to implement, and the bot is good enough :-)

Many players search for the server via the IP address.

Since it is dynamic in this case, an additional query would be super handy.

For example via the query:

" !ip "

The bot would then respond with:

"ip:95.116.12.111"

ps.

i have tucked it away correctly, haven't i?

The BOT only responds to requests or can it also write something independently? for example, when the number of players changes.

Nice idea! Yeah that should be relatively easy to implement. If I get some time over the weekend I might implement it.

Correct, as of currently it will only respond to messages, it doesn't automatically post player number changes, however - the voice channel setting will enable the bot to update the name of the voice channel in real-time to the number of online players

Tesch1933 commented 3 years ago

you are amazing :-) after I adjusted the permissions the error message "Error when updating cache: Missing Permissions" disappeared and the player count is displayed next to the voice channel

Huskehhh commented 3 years ago

All features resolved in https://github.com/Huskehhh/dayz-monitor/commit/d8960cf35390fccb57d92b381d549ad9d2240c48