Skip to content

A Valtteri Bottas/Formula 1 themed discord bot which interacts with users when prompted

License

Notifications You must be signed in to change notification settings

MarcusKyung/Valtteri-BOTtas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Valtteri BOTtas, a Discord Bot

¨ ¨ ¨ ¨

By Marcus Kyung

This Valtteri Bottas themed discord bot is designed to interact with users when prompted.

Contents:

Technologies and Dependencies Used:

  • JavaScript
  • Node Package Manager
  • Discord.js 14.11.0
  • Dotenv 16.3.1
  • OpenWeatherAPI
  • Discordjs/rest 1.7.1
  • Axios 1.4.0
  • Discord-api-types 0.37.46

Description:

This discord bot is designed to interact with users when prompted. It is named after Finnish Formula 1 racing driver Valtteri Bottas. When prompted by a user via slash command or message the bot will return a reply/response. This bot also has additional features upon startup. View all features below.

Setup/Installation Requirements:

  1. Clone this repo from GH to your local machine.
  2. In root directory of the file called Valtteri-BOTtas, add a file titled .env.
  3. Within .env, put in your Discord Bot token using the formatting TOKEN = [your token here]. Other needed tokens are as follows: GUILD_ID, CLIENT_ID, CHANNEL_ID, API_KEY
  4. Using your device's terminal navigate to the production directory, "/Valtteri-BOTtas", and run the command: nodemon. Doing so will launch the bot, you should see a confirmation message in your console. The bot will also appear as online in your discord server with a Playing, Watching, or Listening status which rotates every 10 minutes. The bot will also send a channel message saying "hello" and a preset "welcome" gif.
  5. Interact with the bot via your discord server chat and slash command line.

Current Bot Commands:

The bot is currently configured to reply to the below message and slash commands:

Message Commands:

User Input: Bot Response:
"Hello", "hello", "Hi" Returns greeting
"Help", "help" Shares list of available commands
"When is the next GP?", "When is the next race?" Returns next GP date and location
"Who are you?", "Who is Valtteri Bottas?" Returns brief bio
"Give me a Valtteri Bottas fact" Returns one of 10 random facts about Valtteri
"Does Valtteri like (XYZ)" A thumbs up/down or shrug gif reply based on listed likes/dislikes
"What are weather and track conditions like at (XYZ)?"(1) Returns the temp, humidity, wind info, and a comment on the weather
"How many points does Valtteri have?"(2) Returns total career points (dependent on F1DriverAPI)
"Which driver is in (place)? (2) Returns name of driver, season points, and what place they are in

Note(1): the bot uses OpenWeatherAPI to get current weather data. The bot will only return weather data for 2023 circuit locations. Locations must be queried using specific formatting and track naming conventions ("What are weather and track conditions like at (XYZ)?"). The bot will return a message if the track/circuit is not listed in the API.

Note(2): this API is in development and being hosted locally. Once deployed through a cloud service, this command will be updated.

Circuit Name: Coordinates Used in API Call:
bahrain lat: 26.0325, lon: 50.5106
jeddah lat: 21.5433, lon: 39.1728
melbourne lat: -37.8497, lon: 144.968
baku lat: 40.3725, lon: 49.8533
miami lat: 25.7781, lon: -80.1956
imola lat: 44.3439, lon: 11.7167
monaco lat: 43.7347, lon: 7.4206
barcelona lat: 41.57, lon: 2.2611
gilesvilleneuve lat: 45.5, lon: -73.5228
redbullring lat: 47.2197, lon: 14.7647
silverstone lat: 52.0786, lon: -1.0169
hungaroring lat: 47.5839, lon: 19.2486
spa lat: 50.4372, lon: 5.9714
zandvoort lat: 52.3883, lon: 4.5422
monza lat: 45.6156, lon: 9.2811
marinabay lat: 1.2914, lon: 103.8644
suzuka lat: 34.8431, lon: 136.5411
losail lat: 25.4722, lon: 51.4583
cota lat: 30.1328, lon: -97.6411
hermanosrodriguez lat: 19.4042, lon: -99.0907
interlagos lat: -23.7036, lon: -46.6997
lasvegas lat: 36.2661, lon: -115.1797
yasmarina lat: 24.4672, lon: 54.6031

Slash Commands:

Slash Command Input: Bot Response:
/c43 Returns an embed with info on the Alfa Romeo C43
/teammate Returns an embed with info about Zhou Guanyu
/track (track name) Returns an embed with info specific tracks/circuts
/merch Returns an embed linking to the official Alfa Romeo teamwear site

Additional Current Bot Features:

  • Welcome Message on startup - upon startup the bot will say "hello" and send a preset welcome gif.
  • Activity Status - the bot will display a random activity status every 10 minutes based on a list of 3 activities.
  • Happy Birthday Messages - the bot will send a message to the server when it is a driver's birthday, otherwise no message is sent on startup.
  • Slash command for VB merch - the bot will have a slash command for server users to view Valtteri's Alfa Romeo merch.
  • Race Weather Updates - the bot uses the OpenWeatherAPI to return temp, humidity, weather description, and wind info along with a comment about the track conditions. This feature is only available for 2023 circuit locations. Usage of this command is a little clunky since the API requires specific formatting and track naming conventions ("What are weather and track conditions like at (XYZ)?"). Refactor is planned in future updates.
  • VB Career Stats - the bot can call my F1DriverAPI (https://github.com/MarcusKyung/F1DriverAPI.Solution) to get info on Valtteri's career points, podiums, and race wins. This API is currently being hosted locally and will be deployed through a cloud service in the future. In order to use this feature the API must be running.

Future Planned Bot Features:

  • F1 Trivia - the bot will be able to provide trivia questions to server members about Valtteri, and keep their score"
  • F1 Team Standings - the will be able to connect to an API and return current F1 standings or race results. Ideally, this will be my F1 API here: https://github.com/MarcusKyung/F1DriverAPI.Solution.
  • Bottas Race Standings - the will be able to connect to an API and return current Valtteri's points/results.
  • Slash to see random VB gif - the bot will return a random Valtteri Bottas gif either using a list or through a giphy API call
  • Race Countdown - the bot will return a countdown to the next GP.
  • F1 News Updates the bot will use an API or RSS feed to fetch the latest Formula 1 news and updates. The bot will periodically post news articles, interviews, and announcements from reliable sources on a scheduled interval.

Known Bugs:

  • Message command "Which driver is in (place)" only recognizes specific input place names i.e. "first", "second", "tenth" etc. for "first" through "twentyfirst". This is due to the way the command is parsed and passed to getWDCPlaces.js. Future refactor will include a more robust way to parse the input and pass it to the API call to include other semanticly correct inputs such as "1st", "2nd", "10th" etc. Alternatively, this feature may be scrapped in favor of a slash command which simply returns the full table of standings.

License:

For questions, comments, or concerns please reach out at Kyungmj@gmail.com

MIT License:

Copyright (c) [2023] [Marcus Kyung]

About

A Valtteri Bottas/Formula 1 themed discord bot which interacts with users when prompted

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published