Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help with installing/compiling #1

Open
Snake3y3s opened this issue Mar 1, 2021 · 8 comments
Open

help with installing/compiling #1

Snake3y3s opened this issue Mar 1, 2021 · 8 comments

Comments

@Snake3y3s
Copy link

Snake3y3s commented Mar 1, 2021

Good day... I'm actually super green to all this, But I really need this Bot for our channel. so wondering if I can get some more in-depth instructions.

I installed the latest Microsoft Visual C++ and Rust, downloaded the Github repository (as a .zip) unpacked it into a folder. opened command prompt, ran 'cargo run --release' from inside the folder. But i am getting errors that link.exe is not found.

so im stuck as to what to do next.
please can you assist?

@plaets
Copy link
Owner

plaets commented Mar 7, 2021

Sorry for late response, I was 100% sure this was posted on another repo. The bot is currently sorta broken (agressive_lock does not work), I will post here once I fix it. I'm not sure if I can help with compiling it on Windows as I don't use it for development. Could you post logs from cargo run --release?

@plaets
Copy link
Owner

plaets commented Mar 7, 2021

Looks like none of this will be needed (unless you want to contribute to the code). I managed to setup a ci/cd pipeline, the latest windows build is available here: https://github.com/plaets/channel-lock-scheduler-bot/releases/tag/refs/heads/master. I tested it on a Windows x64 VM and it seems to work just fine. Feel free to post if you encounter any other issues.

@Snake3y3s
Copy link
Author

Thank you for the reply and looking into this.
but I am still unsure how to get this working. Do I just run the .exe? Do I still need to compile the code?

Any assistance is appreciated
thank you

@plaets
Copy link
Owner

plaets commented Mar 9, 2021

You don't need to compile anything, just download the exe I linked, create a bot.cfg file next to it and run it, preferably from something like cmd or powershell so you see the error in case something forces the program to stop

Description of how bot.cfg should look like is here

@Snake3y3s
Copy link
Author

Snake3y3s commented Mar 9, 2021

oh awesome! thank you for that note.
with regards to channel name and role name, can you add multiple channels and roles?
How would I... do they need to be separated by commas or multiple lines?

(multiple lines for example:
discord_token = 'DISCORD_TOKEN' # discord api token
channel_name = 'example-channel' # name of the channel to lock (channel will be created if it doesn't exist)
channel_name = 'bob' # name of the channel to lock (channel will be created if it doesn't exist)
channel_name = 'win' # name of the channel to lock (channel will be created if it doesn't exist)
channel_name = 'start' # name of the channel to lock (channel will be created if it doesn't exist)
role_name = 'example-role' # name of the role that should be locked out of the channel
role_name = 'team 01' # name of the role that should be locked out of the channel
role_name = 'team 02' # name of the role that should be locked out of the channel
role_name = 'team 03' # name of the role that should be locked out of the channel
lock_message = 'locked' # message to post when locking the channel (the message will be posted in the channel that's being locked)
unlock_message = 'unlocked' # message to post when unlocking the channel
lock_on = '0 0 0 * * Mon *' # locking schedule in crontab format, in UTC
unlock_on = '0 0 21 * * Sun *' # unlocking schedule in crontab format, in UTC
agressive_lock = true # if enabled, when the channel is locked, the bot will delete all messages posted to that channel

?

@plaets
Copy link
Owner

plaets commented Mar 9, 2021

Sorry, I didn't have a usecase for managing multiple channels so I did not implement that. I will add this to feature requests so that one day maybe the bot will have such a feature but I can't promise anything. For now it's possible only if you run a different instance of the bot for every channel, that requires some additional work.

@Snake3y3s
Copy link
Author

Snake3y3s commented Mar 10, 2021

ah... no problem
what about the multiple roles per channel?
To have multiple instances, would I then need to create a new discord token for each one?

As a request: for the roles, is there a way to exclude a role that is locked out, so lock all roles except "admin"?

@plaets
Copy link
Owner

plaets commented Mar 10, 2021

My current configuration is to have a role that gives access to the scheduled channel (that role is supposed to be specified in the configuration), disable access to that channel for everybody and then give the role to every user that is supposed to have access to the channel in the timeframe specified in the configuration.
Discord permissions are pretty complicated so I'm not sure if this can work for every case but it was enough for me.
I guess I will also add managing multiple roles to the feature requests.

I'm not 100% sure if you need a new discord token for every instance.
What do you mean by "exclude a role that is locked out, so lock all roles except 'admin'"? Admins have access to all channels unless you enable agressive_lock, in this case the bot will delete messages added to the channel by the admins if the channel is supposed to be locked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants