Code Monkey home page Code Monkey logo

discord-bot's Introduction

Discord-bot

This project is a Discord bot specifically for use with the Discord server. Python 3.8+ is used to write this script with the use of currency converter API of API layer. In this project it basically fetch the current price of British pound (GBP) and then convert it to Indian ruppees (INR) followed by the message in the Discord server. Also it will send the alerts of the high or low values set by the user.

Setup

To run the bot, open the command line in the cloned repo directory and install the requirements using pip with the following command:

pip install -r requirements.txt

Execute

To run the bot, run the following in the command line:

python3 main.py

Output

Screenshot_1

discord-bot's People

Contributors

mohitpatni0731 avatar saranshmaheshwari avatar

Stargazers

 avatar

Watchers

 avatar

discord-bot's Issues

Challenge: allow interacting with bot from discord chat

Just trying to think of a new feature that we can add now that we are familiar with basic API and have got something working.

I am thinking of a feature where after seeing the alert for price, user can send a command to bot to change the max/min limit for alerting.

Run black on whole repo

Black is code formatter which everyone in Python uses to format the code. It formats the code to make it nice and also makes sure that code looks similar even when multiple developers are contributing to it. https://github.com/psf/black

Black playground is available here.

Follow up:

  1. Configure VSCode to autoformat python code with black on save.

Add some tests with pytest

Any big project should have tests. It makes us confident in new changes that we add in that they don't break existing functionality.

Lets add tests for get_current_price and discord_bot function that were written in https://github.com/MohitPatni0731/Discord-bot/pull/1/files. (hint: to bring functions under test we will have to refactor discord_bot function to accept whatever it expects as input inside it as function parameter.)

Add type hints to functions

All modern python code is always written with type hints https://www.pythontutorial.net/python-basics/python-type-hints/.

Type hints helps callers in understanding what type of arguments are taken in by functions and what type of return value to expect in return.

Follow up:

After completing this tasks one should be able to know:

  1. What is static vs dynamic typing?
  2. What is duck typing?
  3. Type hinting in python
  4. What is mypy

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.