A fully customizable bot built with Pycord
About β’ Features β’ Dependency β’ Working
Discord Weather Bot is a fully constomizable Discord Bot that is growing constantly.This bot look for a specific command prefix, such as "#" in our example of Weather Bot. When this combination of are primarily is entered on a server where the bot programme is present and has been allowed access to read the messages, the bot is activated and determines which answer to deliver based on the functions specified. The needed output is sent to the guild if the command is found. Occasionally, data is fetched through an API request to a third-party service.
- Weather Bot is able to perform multiple functions while present in a discord server.
- It can be modified to perform several more functions in the future if required.
- It is able to read messages and commands that are made by the discord users on a server.
- It is able to forecast the weather details of any city or country when commanded with
βw city nameβ
where the city name is the name of the city of which the user wants to know about the weather.
if message.content.startswith('#w'):
- Thus, any discord user who wants to get a weather forecast of his desired city would have to specify his command to β#wβ.
- It promotes user interaction on the server.
- If we input an invalid city name, the bot will return an error message.
- For building this project, I did require multiple things to bring out the final outcome.
- Initially for interacting I had to use the discord API integration, discord.py( βdiscord.py is a modern, easy to use, feature-rich, and async ready API wrapper for Discord.β).
- But later Pycord has been used over discord.py for the convenience of implementing
Slash Command
. - After that for weather forecasting and JSON parsing the libraries and modules used here are requests from the urlib library and JSON for JSON parsing.
- For getting the weather details about any city OpenWeatherMap API has been used.
- Future potential is that it can be connected to a database like MongoDB for fetching previous Weather history.