GithubHelp home page GithubHelp logo

dentaku's Introduction

Dentaku

Dentaku is VikingsDev's open source messenger bot.

Setting up a development environment

  1. Fork the Dentaku repository: https://github.com/VikingsDev/Dentaku.
    (If you don't know what forking is, this example could be helpful.)
  2. Clone the fork. git clone https://github.com/YOUR_GITHUB_USERNAME/Dentaku.git
    (Please input your Github username in place of YOUR_GITHUB_USERNAME.)
  3. Create a virtual environment. python -m venv venv
    (If needed, install virtualenv with pip install virtualenv.)
  4. Create an export file.
    macOS/Linux: touch export.sh
    Windows: Notepad export.sh and accept the prompt to create the new file (or create the file manually in File Explorer)
  5. Edit export.sh using a text editor, and add:
    export EMAIL="YOUR_FACEBOOK_ACCOUNT_EMAIL"
    export PASSWORD="YOUR_FACEBOOK_ACCOUNT_PASSWORD"
    export BITLY_GAT="YOUR_BITLY_GENERIC_ACCESS_TOKEN"
    export G_CREDENTIALS="PATH_TO_YOUR_SERVICE_ACCOUNT_JSON"
    

    Note: Replace the strings with your own information, but keep the quotation marks!
    Get your bit.ly Generic Access Token, which is required if you want to use commands with link shorteners.
    Get your service account credentials, which is required if you want to use commands with Google Cloud integration. This project uses Firebase.
    (Remember to hit save in the text editor before activating the variables!)

  6. Activate the venv.
    macOS/Linux: source venv/bin/activate
    Windows: venv\Scripts\activate.bat
  7. Install the required packages. pip install -r requirements.txt
  8. Run the bot. python main.py
    You should see this:
    Logging in [email protected]...
    Login of [email protected] successful.
    Testing mode will restrict all bot interactions to direct messages, or ThreadType.USER.
    Turn on testing mode? (y/n): 
    

Follow the dialog, and at the end, you should see Listening... which confirms that your bot is on and listening to Messenger.

Keep Dentaku running and check your Messenger! You should have received a message from yourself, saying "Dentaku is online." Test the 'help' command by sending !help to the chat.
Now you can make your own commands by following the guidelines below. :)

Contribution guidelines

For a full, comprehensive read on contribution, take a look at our CONTRIBUTING.md.

To add your own command, create a file named your command inside the commands folder. For example, if I wanted to make a command called dog, and I wanted users to run it as !dog, I would create a file called dog.py inside commands.

Inside dog.py, start with this template:
(Replace all occurrences of 'dog' with your command name.)

from command import Command
from fbchat import Message
from fbchat import Mention


class dog(Command):

    def run(self):
        response_text = "@" + self.author.first_name + " Hello world! This is a dog command."
        mentions = [Mention(self.author_id, length=len(self.author.first_name) + 1)]

        self.client.send(
            Message(text=response_text, mentions=mentions),
            thread_id=self.thread_id,
            thread_type=self.thread_type
        )

    def define_documentation(self):
        self.documentation = {
            "parameters": "None",
            "function": "Undefined."
        }
    

For more information on defining parameters and functions, look for the self.documentation variable on Dentaku's Wiki.

These links might be helpful:

fbchat Examples
fbchat Full Documentation

Dentaku API Documentation

Check the Wiki for API Documentation

dentaku's People

Contributors

amoop avatar caicharley avatar dependabot-preview[bot] avatar dependabot[bot] avatar frankwhoee avatar georgecwan avatar inhostudios avatar joying-yang avatar jpg157 avatar ratanawang avatar wesrchow avatar

Watchers

 avatar

dentaku's Issues

Add !hackathon command

Write a command that pulls and parses information from either the vikings dev event page hackathons, the mlh hackathons, or the hackclub hackathons list and prints out the closest upcoming hack within the area (seattle to vancouver and around)

!weather command to check weather

Accepts location and time as params. location defaults to burnaby and time defaults to now

example usage:

!weather -L burnaby -t tommorow

!weather -t tommorow

!weather -L burnaby

!weather

File sharing feature using file.io

Is this feature a command or keyword?
A command that allows people to create ephemeral file.io links.

What would this feature do?
Share links to file downloads with other people

How should it be implemented? (optional)
Using their API:

https://www.file.io/

Add polling system with memory

Is this feature a command or keyword?
Command

What would this feature do?
Calling

!poll create "Which sticker to bring back?" (tubbs sticker) (kermit sticker) (okay boomer) (goose)

would create a new poll with a unique ID and results stored in memory. !poll would get the last poll's info.

RESPONSE: 
Poll #12 created. Which sticker to bring back?
1) tubbs sticker
2) kermit sticker
3) okay boomer
4) goose
Type !poll vote 12 CHOICE to vote.

!poll vote 12 3
RESPONSE: 
@USER You voted for choice 3, `okay boomer` in poll #12 "Which sticker to bring back?".
!poll vote 12 1 2 3
RESPONSE:
@USER You voted for choices 1,2,3. in poll #12 "Which sticker to bring back?".

How should it be implemented? (optional)
Describe how you would think it can be implemented. Not necessary, but if you know what you're doing, give us some ideas!

Add support for command macros

Is this feature a command or keyword?
This feature is a major change.

What would this feature do?
Allow commands to be strung together. For example, a command could ask you a question and you can answer back and receive an answer.

Example:
"!tictactoe"

| O | A2 | A3 |
| B1 | B2 | B3 |
| C1 | C2 | C3 |

"!tictactoe B2"

| O | A2 | A3 |
| B1 | X | B3 |
| C1 | C2 | C3 |

Create a logo for Dentaku

Make a gold coloured logo for dentaku! Assets for vikingsdev can be found at:

vikingsdev.ca/assets

!fortune

  • a fortune teller that picks from a random list of fortunes
  • limits to 1 fortune per person per day
  • cannot repeat fortunes for people
  • maybe use an api? here's an example

Add tamagotchi game to dentaku

Is this feature a command or keyword?
Command

What would this feature do?
Uses the 0.6.0 memory feature to create a personalized tamagotchi game.

!search command

  • returns Wikipedia page (or image¿) on a specific subject when called
  • would work like this:

Person: !search dogs
VikingsDev: Here is some information about dogs: [insert Wikipedia dog link]

(maybe use frank's build day project somehow¿ idk)

Add !hbd

  • can also be !happybirthday or !birthday or whatever
  • sends a birthday message when it's someone's birthday
  • make it send something fancy + have variation
  • suggestion: can be a larger message since it won't happen so often. can also just send directly to dm
  • potential issues: getting access to someone's birthday? 1 day = more than one person's birthday?
  • experiment with sending stickers?

!countdown stop

stops the recursion from !countdown commands that take forever to complete

String together !a_chance_at_uni parameters in answer

Describe the bug
!a_chance_at_uni does not string together parameters, so users are forced to use underscores for spaces.

To Reproduce
Write the command: "!a_chance_at_uni douglas college"

Expected behavior
Should return

@Frank

 u op guaranteed acceptance at douglas college

Screenshots
image

Platform
Both

Add zucc bamboozle

Describe the bug
Bot is banned regularly for spamming.

To Reproduce
Steps to reproduce the behavior:
Use the bot lol.

Expected behavior
Should limit the number of messages per hour, and number of messages sent per minute.
Turns off at night to fool the zucc.
Takes a proportionate amount of time to "type" as the length of the message.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform
Mobile or Desktop?
Both.

Additional context
Add any other context about the problem here.

!bitly does not append https:// to parameter link.

Describe the bug
When bitly is run, links without https:// does not interpret it as a link.

To Reproduce
Steps to reproduce the behavior:
Send !bitly vikingsdev.ca to a channel with Dentaku

Expected behavior
Should send back a bitly shortened link

Screenshots
image

Platform
Both

Add !next command

Make a command that pulls from the Google Calender API and gets the next three events and sends them to the requester.

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.