Collection of bots to facilitate the organisation of a student group.
Before development of this project, we outlined the main objectives that we wanted to achieve to consider the final product a success. We came up with 2 objectives:
- each bot can fulfil its intended purpose
- each bot will be running in the cloud.
For the first objective to be considered a success, each bot must meet the function we mentioned in the previous outline document. The next objective is being hosted in the cloud. This was one criterion that was outlined at the start of the project outline. So, we consider this one of the main objectives that we must complete in order for this project to be considered a success. This objective is vendor neutral meaning, we are not limiting ourselves to any particular cloud hosting method. This allows for focus on adding the functionalities to the bots, and then finding an appropriate cloud option that can fit the bots.
-
Internal meeting: 29.10.21 (Team PizzaRepublik was created + Brainstorming project ideas)
-
Internal meeting: 3.11.21 (ISD Discord Group was created)
-
Internal meeting: 9.11.21 (Decided to make Discord bots)
-
External communication: 11.11.21 (First proposal made)
-
Internal meeting: 17.11.21 (Discord server was created - IS21 - Classroom)
-
Programming, hosting and testing: 17.11.21 - 9.01.22 (Designing and working on Discord bots' functionalities)
-
Project submission: 9.01.22
-
Final Presentations: 20.01.22 - 21.01.22
The final product of this project we have undertaken, are 6 discord bots. These bots are Wikipedia bot, Calendar bot, Silence bot, Login bot, Market bot, and finally Anonymous bot.
Wikipedia bot given a certain command will look up any Wikipedia and post it in the discord chat. This bot also provides an option so you can pick the language the articles will get retrieved in. We believe that the language option was a necessity, as this university is a very global and diverse setting. This means that users that are not confident in their language capabilities can get an article they are comfortable with.
Login bot function is to have an added layer of security, not stop unauthorized and non-students from entering the server. In order to achieve this, we locked most of the server behind a role. This means that in order to view all of the server, besides the Message of the Day (MOTD) Channel, you need to be “Verified”. This role will be given to the users that can get the password correctly. For added security purposes, all messages sent in this channel are promptly deleted before evaluation, making it harder for individuals to just copy the password inputted. For additional security, the password itself is not stored in plaintext. The password when initiated is one-way encrypted using the hash function, and then compares that hash with the hash output of the passwords being guessed. This bot was created in hopes of making the server strictly for authorized individuals, so users can just add anyone with an invite link. The solution is not necessarily the most secure but we just intended making it trickier for your average individual trying to get into the server.
Silence bot is used as a discussion moderator. It allows for designated individuals with the role “Presenter” to manage the call. This allows for the Presenter to talk freely without interruption that you might see in a zoom call. When the presenter is done and it's time for discussion, the presenter can just input another command and the bot will unmute all individuals. These functions were achieved by collecting all the individuals that are connected in the current call. If the user lacks the proper role of Presenter, they will be muted. For unmuting it will unmute all individuals regardless of role. This bot was created with the idea of making a classroom setting more desirable in discord, as it would be troubling mass muting individuals if the call had the typical size of a classroom.
The calendar bot is used to set important events such as upcoming exams in the current week. This bot works by the users' adding events. Once these events are added to the list of Events, a background tasks will go off every day signalling that there is an exam this week. It determines if an exam is in the same day, by gathering the current date and comparing the week and year number off the isocalender to the same values on the events in the list. Whenever it falls upon the same day, it will then notify that the event is happening today and promptly deletes the event. This is achieved in a similar method as if it's in the same week, but instead just compares the entire tuple of the isocalender of the current day to the event day. Users can also remove events utilizing a provided function. This allows for wrongfully added events to not be a problem. This function works by going through the Events list and getting rid of any event that matches the same name. This bot just aims to be a quick reminder so it only showcases a DD-Mon-YYYY format.
The anonymous bot is a simple bot where users can send messages that the bot will then repeat so no one knows who originally sent the message. This bot functions in a very straightforward manner, any direct message is stored, and then is posted in a specific channel using the channel ID.
This bot allows users to sell & buy their stuff. It facilitates the exchange of unwanted items. Every user can post an item for sale. The bot will post a message on 'marketplace' channel that the item is available for sale. Communication with this bot is only available through direct message. Any messages posted by users in 'marketplace' channel will be deleted by the bot.
Software requirements:
- Python 3.9.0
- installed all packages from requriements.txt file
To install packages:
- activate your virtual environment
- run
pip install -r requirements.txt
in a terminal
Attention!!! Bots private tokens are hidden, because of the security reasons (they are not visible on Github, they are stored locally in .env file). To make use of the bots in your project, you are obliged to create your own applications and tokens in Discord Developer Portal.
Bots are hosted on Heroku Platform heroku.com. 3 accounts were created. Every account hosts 2 bots (this means that the entire project is hosted online). Procfile, requirements.txt and runtime.txt files are necessary for heroku to work properly.
This bot functions in a rather simple manner. There are two different commands that one can issue two this bot. These being “!JC_Help” and “!JC_Stop”. Both of these commands do not require any options or variables following the use of them. The command “!JC_Help” is used when a presenter of a class wants to mute everyone currently connected to the voice channel, unless they are a presenter as well. The command “JC_Stop” does the opposite, of unmuting everyone in the currently connect voice channel.
In order for this bot to function it is required that the bot has access to the permissions of sending messages, Read Messages/View Channels, and Mute members. The mute members permissions necessity is self-explanatory. The bot requires the send messages permissions, as the bot sends messages whenever the presenter issues a command, so they can have feedback if the command worked or not. The Read Messages/View Channels permission was necessary in order to see the channel that the presenter is currently connected to and in order to see which users are connected to the channel.
This bot works through the use of two commands, “!pc” and “!ps”. The command “!pc” is used to change the password for logging. Note that this command can only be used by admins of the server, for security reasons. This command works by taking anything following “!pc” as the new password and then changes it to that. The other command “!ps” is used for people to login to the server. It functions similarly to the other command, where anything followed after “!ps” will be the entered in password. The commands only function like that and have no additional options available.
In order for this bot to function it needs the Read Messages/View Channels, Send Messages, and Manager Roles. The Read Messages permission is necessary in order to see when a user inputs the command. The send messages permission is needed to send the welcome message when a user enters in the right password and is allowed into the server. Lastly, the manage roles permission is needed in order to give the user the logged in role of “Verified”.
This utilizes three different commands “!addevent”, “!rmevent”, and “!viewevents”. The first command “!addevent” works with the user providing the format of Event_name:DD.MM.YYY. This function will break down the following information into the two parts in order for storing the details, with these being Event and Date. For example, if we wanted to add an event for the ISD presentation it would be done as !addevent ISD Presentation:20.01.2022. The !rmevent takes the name of the event that you want to remove, and then will remove all iterations of it in the Event list. Following with the previous example, if we wanted to remove ISD Presentation, it would simply be !rmevent ISD Presentation. Lastly, the !viewevents command doesn’t take any added options and just works typing in the command. It will print every event indiscriminately in the order it appears in the Event list. For calendar bot to function, it only needs the basic permissions of being able to send messages and Read Messages / View Channels. The reasons for needing these permissions are the same as the previous two bots mentioned.
Anonymous bot is the most straightforward bot when it comes both to the concept and use. This bot has one function which is “!pm”. This command will take anything that follows it and then be used in the anonymous message that is sent.
The only permissions that are required for this bot to function are the Read Messages / View Channels and the Send Messages permission. These permissions are used in the same manner as all the bots.
List of available commands:
- !sell
- a user can put his item for sale. The user must provide item's name, category, price and currency.
- it triggers a message in the marketplace channel that an item is for sale, other users can see it now.
- !buy <item_ID>
- user can buy a product by providing its unique ID
- it triggers a message in the marketplace channel that a @user bought a product from @user
- the owner and buyer will be informed by the bot through DMs to take action to finalize transaction
- !show <nr_last_added> or all
- this command provides a list of items for sale directly to the user
- user can specify a number of n last added products (by default 5) or show all products listed for sale
- !delete <what: id nr>
- if the command is invoked by a user who is an owner of the product, it will remove the product for the list
- !want
- this will trigger a message that a @user wants to buy sth in the marketplace channel
- it allows users to communicate their needs
List of available commands:
- !w or !wiki or !wikipedia
- you can add a language flag e.g. -de, -fr, -ru to search for a term in a different language. By default, it's English.
With the anonymous bot, one flaw with the current design from our understanding, is that it may be possible for anyone to send messages to the bot if they can someone open a direct message with the bot. This will be fixed in a future implementation of the bot, by making sure that the individual actually has the verified role. This will require some special permissions and a lot of added steps.
The Calendar bot, currently only faces one issue which is with it lacking exception handling. The bot can run into some errors depending on the inputs that the user puts in. This has caused the bot to crash and no longer function.
Generally speaking, we achieved most of our goals for this very specific Information Systems Development project, we would say that we have done a great project as a team, not only we have successfully created all six bots we wanted, but also, we have learned a lot from planning, managing and implementing the project. To be more specific, there are three most important things we have learned from working on this project.
Firstly, we have learnt how to communicate more efficiently with others by working on our ISD project as a team. For example, because we were all busy with our daily schedules, it was sometimes very challenging for us to arrange a time that satisfies everyone with regards to the group meetings or assignments, we needed to understand each other and help each other instead of complaining, and luckily, we managed to do that very well due to our supportive, open and honest communication mechanism.
Secondly, without no doubt that a good knowledge of programming is the prerequisite for achieving our project goals, however, it is also very important to keep learning new things as a programmer, for example, none of us has experience when it comes to host Discord bots on cloud, we needed to start from zero and learn how to do it through doing researches and watching online tutorials, it is a good training for us to set up a correct mindset for the future career.
At the same time, we have also learnt how important it is to improve our time management skills as a team as well as individuals, even though we have set up our internal deadlines at the very beginning of our project, we sometimes still forgot important dates and it brought inconvenience and troubles to our teammates, which was a very important lesson to learn and we appreciate the experience.