Coder Social home page Coder Social logo

lorestrider / whatsapp-bot-project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arielyat/whatsapp-bot-project

1.0 0.0 0.0 1.18 MB

WhatsApp Bot ๐ŸŒŸ - for groups and individuals

License: GNU General Public License v3.0

Shell 0.13% TypeScript 99.19% Dockerfile 0.68%

whatsapp-bot-project's Introduction

WhatsApp Bot - Harold The Undertaker

Table of Contents

Description

This is a Whatsapp Bot built with TypeScript and Node.js with a MongoDB database.

It has a lot of different functions and features and is currently not really in development.

If you have any questions, feel free to contact ArielYat or TheBooker66.

Running the Bot

Note: the @open-wa/wa-automate library has been sent a cease and desist by WhatsApp and stopped development. This means that a lot of features may break following WhatsApp updates.

Prerequisites

  • A machine with node.js and mongoDB with a good amount of RAM (4GB+ recommended).
  • A configured apiKeys.ts file (you need to create it following the explanations and examples in apiKeys.example.ts). Not all the fields have to be satisfied, but for the bot to work correctly it is recommended to complete all of them (all the services needed for the API keys are free or offer a long free trial). We recommend leaving the configObj as it is.
  • Note: the Stable Diffusion commands will not work without a docker container configured very meticulously like ours running Stable Diffusion (basically don't use them).

Actually Running it

  • Run npm install in a terminal in the main folder of the project (only needs to be done the first time the bot is ran to download all the packages according to package.json).
  • Start the mongoDB server by using one of the these options:
  • If you want to run the bot without Docker and a VPN, running npm run start in the terminal after commenting out lines 309-317 in Main.ts (to removed the VPN check) should work. After the bot starts, scan the QR in the ternimal with your phone's camera to link the WhatsApp account and enjoy the bot.
  • If you want to run the bot using Docker and a VPN, good luck.
  • If you want to add another language to the bot, do it in Strings.ts following the pattern and using RegExs where needed. If you actually do this, we'd love for you to send us a pull request to add the language to the official bot.

Commands and Features the bot responds to

  • Change language to [language] - changes the language the bot receives and sends messages in.
    • For example: Change language to Hebrew.
    • This command can be used at all times in every language.
    • Languages currently supported: Hebrew, English, French.
  • Help [-|language|filters|tags|birthdays|permissions|reminders|stickers|internet|others] - shows the various help messages, which in total list all the commands (except those available only to bot devs).

Filters can be text, images or videos

  • Add filter [filter] - [bot reply] - adds a filter to the group.
    • For example: Add filter food - banana.
  • Remove filter [filter] - removes the specified filter from the group.
    • For example: Remove filter food.
  • Edit filter [existing filter] - [new reply] - edits the specified filter.
    • For example: Edit filter food - peach.
  • Show filters - displays the list of all filter and their replies in the group.
  • Special Tip: When adding a filter you can use [name] to tag someone when the filter is invoked.
    • For example: Add filter food - [Joseph] will make the bot tag Joseph whenever "food" is said.
  • Tag [person] - tags someone so that they get a notification even if the group is muted on their phone.
    • For example: Tag Joseph.
  • Tag everyone - tags all people in the group.
  • Add tag buddy [name] - [phone number in international format] - adds the person to the list of taggable people.
    • For example: Add tagging buddy Joseph - 972501234567.
  • Remove tag buddy [name] - removes the person from the list of taggable people.
    • For example: Remove tagging buddy Joseph.
  • Add tagging group [tagging group name] - [names of people in the group, divided by commas] - Adds a tagging group which can be used to tag multiple people at once
    • For example: Add tagging group Banana - Moshe, Joseph, Aviram
  • Remove tagging group [tagging group name] - removed the mentioned tagging group
  • Show tag buddies - displays the list of all taggable people in the group
  • Check where I've been tagged - replies to all the messages in which the author has been tagged, bringing them to the front of the chat.
  • Clear my tags - clears the saved tags of the message's author.
  • Activate do not disturb or !afk - sets the the user's status to "afk", which means they won't get pinged.
  • Add birthday [date in international format with periods] - adds a birthday for message's author.
    • For example: Add birthday 1.11.2011.
  • Remove birthday - removes the author's birthday.
  • Show birthdays - displays the birthdays of the group members.
  • Add group to the birthday distribution list - adds the group the message was sent in to the author's birthday message broadcast.
  • Remove group from the birthday distribution list - removes the group the message was sent in from the author's birthday message broadcast.
  • Define permission for [permission type] - [Admin/Regular/Muted] - defines the permission level required for a certain type of commands.
    • For example: Define permission filters - Admin.
    • Permission types: filters, tags, handle_Filters, handle_Tags, handle_Birthdays, handle_Shows, handle_Other.
  • Mute [person tag] - mutes the tagged person, so they aren't able to use commands.
    • For example: Mute @Joseph.
  • Unmute person [person tag] - unmutes the tagged person.
    • For example: Unmute @Joseph.
  • Show function permissions - displays the permissions levels of the different types of commands.
  • Show people permissions - displays the permissions levels of the people in the group.

All the reminder related commands work only in a private chat with the bot. Reminders can be text, images or videos The date in the commands is optional (if no date is inputted the assumption is that the reminder is for the same date the message was written in) and can include or not include a year.

  • Add reminder [repeat] [date] [time] [text] - adds a reminder to the message's author.
    • For example: Add reminder 2.5.2023 7:34 Walk the cat
    • The optional parameter "repeat" creates a repeating reminder every day from the first date specified at the specified hour.
    • Reminders can be text, images or videos.
  • Remove reminder [date] [hour] - deletes the reminder set at the specified time.
    • For example: Remove reminder 7:34
  • Show reminders - Shows the author's reminders.
  • Create sticker [without cropping] [High Quality/Medium Quality] - creates a sticker out of a message or a media file and sends it
    • This command can be used in the message the media was sent in and as a reply to it
    • without cropping is an optional parameter which creates the sticker without cropping it
    • high quality and medium quality and option parameter which control the sticker's resolution; the default is medium quality
  • Create text sticker [colour] - [text] - creates a sticker without a background with the given text
    • If the parameter "colour" isn't given, the default is black

All of the commands below have a certain daily limit

  • Check Crypto - sends a message with the exchange rates of ten different cryptocurrencies compared to the Dollar.
  • Check stock [stock symbol] - sends a message with the current info about the stock.
  • Internet definition [word] - searches for the word in the website Urban Dictionary and returns the search result.
    • For example: Internet definition chair
  • Translate to [some language] [words] - translates the words to the given language via Google Translate.
    • For example: Translate to Hebrew chair
    • In the translation text only one sentence can be written due to Google Translate restrictions.
  • Download music [link to youtube] - downloads a song from youtube and sends it as voice message.
  • Transcribe audio - transcribes the voice message the comment message replied to.
  • Scan [link] - scans the given link for viruses.
    • For example: Scan https://www.google.com/
    • Links can be scanned in the message the command is sent in or in a quoted message

Miscellaneous Commands

  • Profile - shows the bot's information about the message's author
  • Change link type [link] - changes the link type of the given link from a Youtube Shorts or Wikipedia Mobile link to a regular Youtube to Wikipedia link and the opposite.
  • My guess is [guess] - Guesses a word in the game Wordle.
    • For example: My guess is blush
  • Create a WhatsApp survey:
  • Create survey Title - [survey title] Subtitle - [survey subtitle] Third Title - [third title] Button 1 - [first option] Button 2 - [second option] Button 3 - [third option]
    • (The third title and buttons 1 and 2 aren't required)
  • /Ban [user] & /Unban [user] - ban/unban a user from using the bot.
  • /Block group & /Unblock group - block/unblock a group's members from using the bot.
  • Join [link to Whatsapp group] - Invite the bot to a group via a link.
  • !Ping - shows the ping, the current chat amount, the total chat amount, the total user amount, the current muted group amount, the current muted user amount and the time since startup.
  • /exec [command] - executes the given command.
  • Help admin - shows the admin commands.

The bot also autotempbans groups or users who are spamming it for a short time period.

Dependencies and APIs used

Main Dependencies

@open-wa/wa-automate for the WhatsApp "link".

mongodb for storing our database.

node-fetch for sending some requests to APIs.

APIs

CoinMarketCap for checking cryptocurrency prices.

Urban Dictionary for Urban dictionary.

Google Translate for translating texts.

Alpha Vantage for checking stock prices.

Whisper - OpenAI for transcribing audio.

Not exactly APIs, but youtube-dl and ffmpeg for downloading music, and Stable Diffusion for generating imagery.

Acknowledgements

@ArielYat - Ariel - Starting the project and developing most of the bot's functionality

@TheBooker66 - Ethan - Developing a lot of the bot's functionality, code review and order and English support

@Arbel99 - Arbel - Latin support

Maayan Ranson - French Support

@Lainad27 - Daniel - Developing the message to a sticker functionality

License

This project is licensed under the GPL-3.0 license.

See LICENSE for more information.

RIP

  • Moshe
  • Aviram
  • Alexander The Great
  • John The Legendary
  • Jackson The Immortal

whatsapp-bot-project's People

Contributors

arielyat avatar thebooker66 avatar arbel99 avatar tomershush avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.