Inspiration

I was inspired by the recollection of the many arguments with my friends that happened over Discord. Often times, I would want to perform a quick search on Wikipedia to gather evidence to prove my point, but I found the process of opening a tab and searching on Wikipedia on my browser too tedious and slow for my liking. Hence, I got the idea of the WikiBot.

What it does

The Bot allows you to easily perform Wikipedia searches from your Discord server. There are 2 main modes:

  1. Extracting a summary on information
  2. Extraction information from a specific section

The bot involves 4 main commands:

  1. Get_ten_sections: Get a list of the first ten sections on a Wikipedia page of the user's input. If there are more than 1 articles on the input topic, the bot will return a list of all of them, so the user can try again with a more specific search.
  2. Return_section: Returns the text from a specified section of the Wikipedia page on the inputted topic. It is designed to be used in conjunction with get_all_sections.
  3. First_result_summary: Recommended method of gaining a summary. Returns a text summary of a Wikipedia page of the user's input. If there are more than 1 articles on the input topic, the bot will return a summary of the first article.
  4. List_summary: Returns a text summary of a Wikipedia page of the user's input. If there are more than 1 articles on the input topic, the bot will return a list of all of them, so the user can try again with a more specific search.

How we built it

This bot was built with Python, using the Discord API as well as the Wikipedia API. The Discord API allowed me to create slash commands, which is the basis of the bot's main functionality: Wikipedia searching. The Wikipedia API allowed me to actually access data from Wikipedia.

Challenges we ran into

A significant challenge was the fact that some search topics, such as Python, had multiple articles written about it. Therefore, the bot would only give a message saying "__ may refer to...", which was sub-optimal. My solution involved 2 methods to deal with the situation. The first involved processing all the hyperlinks on the page leading to the different articles, and choosing the first article to show a summary of. That is what the first_result_summary command does. The second used all the hyperlinks to create a list of more specific topics to search, allowing the user to follow up with a more specific search on the intended topic. That is what the list_summary command does.

Accomplishments that we're proud of

I am extremely proud to have successfully finished this project, as I have been wanting to do this project for over 6 months and never mustered up the energy to actually follow through with it. Furthermore, this project has a tangible product and outcome that I can use in my daily life, as I can add this bot to my Discord servers and use it whenever I want. This is an extremely huge accomplishment for me, as a beginning hacker. I am also extremely proud of the Readme I created. Whenever I go on a public GitHub repository, I am always in awe and overwhelmed by the impressive Readme designs. I couldn't imagine how I would ever be able to create such a detailed Readme. However, in this project I was able to learn to produce an extremely detailed and aesthetically pleasing Readme, which I'm extremely proud of.

What we learned

I learned how to make Discord bots, and how to use the Discord API. I also became more familiar with using Decorators in Python, which I used extensively in this bot's code. I also developed my skills in creating a beautiful Readme on GitHub, which I will be able to apply in future products.

What's next for Discord WikiBot

Next, I may try to add more commands for the WikiBot, such as searching in different languages, returning hyperlinks the user can click on, etc. Also, I might write some code to allow the bot's responses to cut off at the end of a sentence, not when it reaches the Discord character limit.

Built With

Share this project:

Updates