Updated Project: Complete rewrite and refactor of an old non-hackclub project.
This is a discord bot made for large friend groups of ~10+ people.
Updated Project: Complete rewrite and refactor of an old non-hackclub project.
This is a discord bot made for large friend groups of ~10+ people.
Mostly bug fixes before I ship. I missed a few return statements and a few ephemeral=True statements. Notable changes:
/vc rename was removed, use /vc modify instead/startelection was renamed to /resign
v1.0.3
Log in to leave a comment
I have completed all the TODOs in my code, so there are many new features!
There is now a /vc modify command for changing settings of your room. It contains a few settings:
/vc create command now also allows setting invited people directly via the modal, which is useful for the “just me” permission level.get_or_fetch to avoid unneeded API callsdiscord.MessageReference.from_message(message) so they don’t throw warnings on every useLog in to leave a comment
After an election, the new leader can pick a vice-leader that is granted permission level 3. By default this prevents them from getting kicked, and a few other things. You can also make it so that the leader is required to set a vice-leader. You can also disable picking a vice entirely.
Elections are now automatically started when the leader leaves. This is reliant on the pycord cache, so while it should work most of the time, sometimes the on_member_remove function may not be called. To my knowledge, I cannot fix this, however this should only be a problem with abnormally large servers and an overthrow passing right after bot start. I may try a fix at a later time.
Log in to leave a comment
You can now overthrow the current leader with a vote, I cannot calculate majority due to a lot of factors, so the required votes is a config value.
Log in to leave a comment
More logic has been added, including settings for some existing functions, and scheduling elections.
You can now set a day of week and hour to automatically start an election.
The bot now logs when an election restore is attempted, and the state id it is recovering from.
You can now change the target end hour for elections.
The election channel is now automatically deleted, and force_vice is now enforced, but there is currently no way to pick a vice leader.
Every state of an election can now be restored (to my knowledge). The bot now saves who has won the vote before deleting the messages. The only downside is once the bot is back up, it does not have enough information to play the animation, but roles are still given out.
This is work in progress, the feature does not fully work yet, but the channel is now automatically created. More info will be shown probably next log.
Whoever is being voted on can no longer see the vote channel, e.g. the person being votekicked/promoted can not see that they are in a vote (unless you give them audit log/administrator perms, this is a reminder that most bot features will not work if anyone has administrator perms).
Important messages are now pinned.
Log in to leave a comment
hackatime was down so this is pretty long
I couldn’t think of a good name for this devlog, but it includes a pretty important feature. The groundwork for leader elections is now here, and contains a lot of features.
There is no actual way to start an election right now, the demo video just creates a fake save state that the bot assumes is correct. However, when there is a way to start an election, the start function allows a reason to be passed in. When the channel is made, it is locked to everyone until all the messages are set up, then it is unlocked and an @everyone is sent.
The bot can be turned off or terminated (except during tallying), and pick up from where it left off when turned back on. I set a challenge for myself to not store any data on disk, so the current election state is stored within invisible characters in the channel topic. I have a function that takes a decimal input, and converts it into binary, then converts the binary into a string of invisible characters that can be put in the channel topic, and is invisible. The characters can only be seen by opening the channel topic, then highlighting all text.
If no votes are cast the leader and vice-leader stay the same.
All messages should be deleted, the demo video shows one getting past because it was recorded before the fix. There is a little “animation” that plays when the election finishes that shows the top 3 placements. If there is a tie for first, the leader is randomly chosen. The channel is deleted an hour after the vote concludes, but a simple <user> is the new leader! message is sent in the public channel, and a log of the top 3 places are sent in the log channel. The send message permission is also locked to leader and vice leader after the vote is over.
A few features can be locked during elections, like kick, votekick, and promote.
Hopefully hackatime works today so I can post shorter devlogs.
Log in to leave a comment
Rooms now have more features! You can manually add/remove members from your channel. This also means the Just me vc option has a reason to exist now. When you add a user, they are given connect permission. When you remove a member, you can choose to kick them from vc, or keep them in, but their connect permission is removed. Also, /vc rename exists now, you can rename your channel after it has been made.
Log in to leave a comment
You can now end your vc, and either kick everyone out or move them to another call. If you chose to move members, it respects permissions, but you must have permission for it to move anyone else. If someone is not able to join the vc, you will be told.
The max number of rooms was fixed, I forgot to actually save the amount of rooms you have, so it always thought you had zero.
Starting the bot while people are in rooms no longer throws an error
Log in to leave a comment
This devlog contains many small changes that I don’t think need their own devlog. These changes are:
load_config now uses os.path.join instead of raw strings/features/plusvote/required_wait is now enforced. Members must wait 48 hours before being eligible to be promoted. The vote is still required.Log in to leave a comment
You can now set up regex for messages you want the bot to automatically reply to messages. The settings are:
There are also a few backend UX improvements. The 5 minute voice cache duration can now be changed, and when missing a config option, the full path is now shown.
Log in to leave a comment
Pretty simple update. Somehow, discord has not added the ability for voice channels to call people in servers yet. This is the closest I could get. The bot can ping for the first person to start a call, and can be configured to also:
Log in to leave a comment
This took somehow way more and way less time then i thought it would. Anyway, when you are server muted/deafened or channel permissions prevent you from talking, the bot takes note of what you can do, and saves/restores it when switching channels. This fixes being able to make your own voice channel, and unmute yourself, then rejoin wherever you were muted. Right now, they are saved for a minimum 5 minutes, but can be extended when you update your voice status. This might not seem like much, but this is really useful to me.
Log in to leave a comment
You can now promote guests to plus members by a vote. This one was faster then the votekick because most of the code is copied from votekick, so it works basically the same. Some of the code that I think will be reused in future votes is now in functions.
Log in to leave a comment
This devlog contains pretty small changes to some wording, but I still wanted to make it because I forgot some demo images in my last one. Some notable (but still small) changes are:
/vc create now allows disabling people from using activitiesLog in to leave a comment
This update includes a few features, including votekicks. People can now start votekicks to kick members out of the server.
As always, there is a lot of config, and you can change:
Permission checks can now be completed by a decorator
Log in to leave a comment
People can now time each other out! It’s mostly for fun, not for actual moderation. It has a configurable timeout duration and cooldown. You can also make the duration different when the leader times someone out!
Rooms that are created now actually get deleted when you leave
People can no longer change the channel status when in a room
Permissions are actually enforced now
Log in to leave a comment
The text boxes work correctly now! The support team in pycords discord server got back really fast, and was really helpful. The fix was to use a pre-release that contained the bugfix. Anyway, you can now limit what others can do in vc, and change how many people can be in it at once. The channel owner can also bypass their own restrictions.
Log in to leave a comment
After messing with modals for an hour, I got something mostly working. The channels do not auto delete yet, but most code is there. There is a weird bug right now where the text inputs should be optional, but are not. This looks like a library issue, so I will wait for a fix. Voice channels can be made, and the privacy level can be set up to whatever you can join, but the features and max people boxes do not work yet. Auto delete when nobody joins is working though!
Log in to leave a comment
I have now planned out how the permission system will work. This is still a work in progress and new things will be added, but this is a good start. Sadly, discord does not let bot owners restrict commands to roles, so it is not possible to have the buttons hidden in UI.
Log in to leave a comment
The bot and example config have all been planned out. The rest of this project should be implementing features from this config file to make everything work. I have a lot planned. I’m also giving myself the challenge of not using a DB, or any data storage, if possible, everything should be stored inside the discord server. The config file has also been documented, so anyone who wants to use my app, should have little trouble, even though it asks for a lot.
Log in to leave a comment