Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

ThibautPlg/Discord-LEGO-Bot

Repository files navigation

LegBot : The LEGO Discord bot

npm nodejs

Logo

This LEGO Discord bot is used to show general informations about LEGO sets and parts in chat.

Website


100 servers

Since July 2020, LegBot has been invited to more than 100 servers ! Thank you everyone ! I hope the bot is doing right for your queries, do not forget to contact me on twitter if something goes wrong or is missing !

As of February 2021 LegBot is on more than 300 servers ! This is insane ! March 2021 : 400 ! I'll consider adding a tag instead of editing this file. September 2021 : almost 600 ! Thanks you everyone !

(June 10, 2024) - Legbot is now selfhosted only

On July 6th 2024, Legbot will start to dysfunction.

This is due to a change in Discord's policy that requires developers to prove their identity through an official document. And there's no way that I will give them my ID card.

If you want to use Legbot for your Discord server, you will now have to selfhost the bot using this repo code.

Thanks everyone who supported this project for the last 4 and a half years. I can proudly say that it was installed on more than 900 servers, only through word of mouth. Thanks to the people who contributed with ideas and improvements.


Commands :

All commands are listed on Legbot's website.

  • !set [SET NUMBER] to have general useful infos about a specific set

Parts Example

  • !part [PART ID] to have informations about a piece (Bricklink id).

Parts Example
Green for pieces still produced, orange otherwise

  • !search [query] Search for a set by name (Beta feature, may be surprisingly wrong)
  • !part " search terms " Search for a part name (Beta, not usabe in the middle of a sentence)
  • !mixeljoint Show a list of the most used mixeljoint (with an awesome drawing of each)
  • !bs [SET NUMBER] Get a direct link to the Brickset page of the set
  • !bl [SET NUMBER] Get a direct link to the Bricklink page of the set
  • !review [SET NUMBER] Get the set score based on the BrickInsights review
  • !help Show all the bot commands
  • !inviteLegBot Get a link to invite LegBot to your server
  • !credits Display the bot credits

Interactions

On most of Legbot's messages you can add reactions to have specific behaviour.

🔎,🔍 or 🖼️ within 240 seconds

:mag_right: :mag: :frame:
Will post a bigger picture of the set/part. (Useful on mobile where you can't click the thumbnail !)

🗑️ within 240 seconds

:wastebasket:
Will delete the message. Works on the pictures posted by the 🔎,🔍 or 🖼️ interactions.

Credits :

This bot is based on the discord.js library.

Requirements :

  • NodeJS 16.9.x or higher

Installation :

  • Clone this repo
  • Delete README.md and the readme.assets directory (optionnal)
  • Run npm install
  • Set your own api keys and tokens in a fresh config.json based on config.example.json
    • The trigger conf is the "how" you speaks to the bot. Default : !
  • Run node app.js
  • Enjoy

Invite me !

Sponsorship

Giving a tip through Liberapay or Coindrop will help me paying the monthly bill of the bot hosting. (About $7 a month). Surplus will go to Brickset and Rebrickable as Legbot would not be the same without them.
Donate using Liberapay

Support and contact

Twitter

Changelog

Legbot changelog and versions are available on the release page.

  • 1.5.5
    • The !set command now returns the designers of the sets (if available) and the related Bricklist.
      • Require an external script to get this data.
    • Improving !set string parsing in middle of sentences.
    • "Delete" and "bigger picture" reactions have now a timeout of 240 seconds instead of 120.
    • Legbot now replies directly to the original message.
    • Adding websites favicon at the bottom of cards depending on the origin of the data.
    • Upgrading discord.js version and changing node-fetch call to match the new behaviour of the library.
  • 1.5.4
    • Improving the !part search using a Levenshtein implementation to find the most relevant results.
    • Adding the "Print of" section in the part card if the given result is a printed version of a brick.
    • Adding the "Alternates" section in the part card to show mold variations (like 4081a / 4081b)
  • 1.5.3
    • The "bigger picture" reaction can now itself have a 🗑️ (:wastebasket:) reaction to delete the enlarged picture.
    • Extended the 🗑️ (:wastebasket:) reaction listener from 60 to 120 seconds.
    • Prices and PPP now contains UK and DE prices.
    • Fixing the date output for a part released during a single year (no more "from 2002 to 2002")
  • 1.5.2
    • Various improvements.
    • You can now add a 🔎,🔍 or 🖼️ reaction within 120 seconds to ask the bot to post a bigger picture of a set or a part.
    • Adding a direct link to the Brickset search page at the end of the !search results.
    • New parts are now distinguished from "in production" and "no more produced".
    • Fixing an issue where the instructions links were broken.
  • 1.5.1
    • Various bug fixes.
    • You can now delete a bot message by adding the 🗑️ (:wastebasket:) emoji as a react in the 60 seconds following the post.
    • Experimental pieces search feature. Set the query between double-quotes like !part "Mahiki Metru".
  • 1.5
    • Adding the instructions section to a set query. Thanks @"Commander Purple" on top.gg for the idea !
    • Adding the AGPL licence.
    • Updating nodejs to v16.x
    • Updating discord.js to 13.x
    • Adding a beta feature to search for sets using !search Piruk for example.
    • Adding the maximumSearchResults correspondig var to limit the bot output.
  • 1.4.4
    • Blacklist some queries ! !set 69 is a very fun search, but uses bandwidth and server resources.
  • 1.4.3
    • All REST requests are now using the async node-fetch way.
    • Improving the !part search by doing a second request if the first one did not find anything.
    • Adding badges to the README.md
    • Updating the log system to be csv-parsing compatible
  • 1.4.2
    • Adding a custom command to fetch the Brickset's random set of the day
      • Require an external php script (at the moment)
  • 1.4.1
    • LegBot is now able to fetch sets with hyphens ids (6862-1 or 6862-2 for example).
      • The old way is still working, but will fetch the "-1" set by default.
    • Updating the readme.md to say that LegBot is now on almost 300 servers !
    • Brickset is now listing LegBot in their apps section !
    • Updating the discord.js lib to 12.x
  • 1.4
    • Removing the ability to search for multiple pieces (vers 1.2.1), it was not used
    • Removing the corresponding config var (piecesMax)
    • You can now pass a command in the middle of your sentence ! For a more natural flow.
  • 1.3.1
    • Fixing a crash on !bl and !bs commands.
    • Fixing a crash where no sets were found but with a success message from the API.
  • 1.3.0
    • The great comeback of the full !set command. Thanks you Brickset for the API key :)
    • Adding a config entry for the Brickset API key (bricksetApiKey)
  • 1.2.3
    • Not a big update, I just wanted to mess around with a MixelJoints custom feature.
      • Not that crazy tho. !mixeljoint
    • Updating the custom functions declaration by removing the necessity to specify the directory.
  • 1.2.3
    • Due to an update at the main external API, sets data has been missing for few weeks. !sets and !review are now back, but with less informations than before. I hope I'll be able to fix that soon.
    • Review are now returned with a pretty "card", like other queries.
    • Addin a debug log
    • Adding the corresponding config var (debug, bool)
  • 1.2.2
    • You can now add custom functions without messing with existing code, simply add a js file and declare it into the config var. (See custom/example.js)
    • Adding the corresponding config var (moreFunctions, can be an array)
    • The bot is now adding a 🙄 reaction to a message if he didn't find the piece / set.
    • The bot is now adding a 🤔 reaction when there is no set or parts id given.
    • General code rework on message var.
  • 1.2.1
    • You can now search for multiple pieces (ex : !part 36840 36841)
    • Adding the corresponding config var (piecesMax, default = 2)
  • 1.2.0
    • Adding logging of commands, anonymously, to get infos about most used commands to improve them in the future.
  • 1.1.0
    • Adding the !botinfo command
    • Updating the readme
    • Ordering code
  • 1.0.0
    • Initial release