GithubHelp home page GithubHelp logo

usertxt / discordbot Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 4.0 148 KB

A Discord bot with multiple features

License: MIT License

Python 100.00%
discord-py discord-py-rewrite discord cryptocurrency bitcoin coingecko twitter twitter-api python discord-py-slash-command

discordbot's Introduction

usertxt's Discord Bot

A Discord bot

Written in Python 3.9.0

Installation

Install required packages

Note: This app is written with the discord.py rewrite, some commands will not work on other versions. More information can be found here: https://discordpy.readthedocs.io/en/rewrite/migrating.html

 pip install -r requirements.txt

Configure

Configure the app using config.json

Rename config.json_sample to config.json

Add your bot's token to:

"TOKEN": "YOUR_TOKEN"

Fiat is set to USD by default. Set your default fiat currency with:

"BASE_CURRENCY: "CURRENCY"

Note: Use the lowercase three letter symbol for your BASE_CURRENCY currency or the API won't fetch the information properly.

IMPORTANT

Always back up your config file, the changes that are made on the repository might replace your local config file with the default one. Some steps have been taken to help mitigate this problem, however you should always keep your API keys and tokens safely backed up elsewhere.

Cogs

Admin

The admin cog includes functions that only you or someone you set as the admin will be able to invoke. You will need to insert your unique Discord ID into the config under DISCORD > ADMIN_ID. Here are two ways to get your Discord ID:

  1. In Discord, go to Settings > Appearance > Enable Developer Mode. Right click on your username in any channel and select Copy ID.

  2. Set up the bot as you would normally without adding your ID to the config. Run the bot and attempt to use the clearlog command. By invoking the command, you have added an entry into the log with your information. The information will appear as username#1234[YOUR_ID]. Open the log and copy your ID into the bot's config. Rerun the bot.

CryptoTicker

CryptoTicker uses CoinGecko's API to fetch cryptocurrency prices.

Usage:

!price <ticker> [base_currency] 

Examples:

This command will return the price of Bitcoin vs the base currency you have chosen in your config:

!price btc

Note: You are able to use the symbol or the full name of the currency. BTC or Bitcoin.

And this command will return the price of Bitcoin vs the Australian dollar:

!price btc aud

The basecurrency command allows you to use the bot to change your default base currency:

!basecurrency <currency>

Example:

!basecurrency aud

StockTicker

StockTicker uses the Alpha Vantage API to fetch stock quotes. You will need your own API key to run this cog. Get yours for free at https://www.alphavantage.co/

Usage:

!quote <ticker>

TwitStream

TwitStream fetches user's tweets and relays them to your Discord channel.

You will need your own Twitter Developer account and your own keys for this cog to work. You can apply for a Twitter dev account here: https://developer.twitter.com/

Commands:

The following command will fetch a tweet from the user's timeline:

!twit <screen_name> [count]

The optional count parameter will return the user's tweet based on the order the tweet is in their timeline. None or 1 is the most recent tweet, and 2 would be the user's second most recent tweet, etc.

Dictionary

This cog adds the dict and urban commands.

Usage:

!dict <search_term>

The following examples apply to both commands within the cog

For single word inquiries:

!dict hello

For multiple word inquiries:

!dict "hello world"

Note: When using the slash commands for this cog, the quotes are not necessary

Running

It is highly recommended that you use a virtual environment for setting up and running this bot. After cloning this project and entering the directory you cloned to, run:

python -m virtualenv venv

This will create a folder inside your cloned directory named "venv" with all the necessary Python files to run a separate source for the bot to run. Any pip installs while the virtual environment is activated will be installed here.

Next you will need to activate the virtualenv:

On Linux:

source venv/bin/activate

On Windows:

venv\Scripts\activate

After successfully activating the virtual environment, you will see (venv) on your command line.

Next, install the requirements:

pip install -r requirements.txt

Finally, assuming your config.json is all set up, run:

python bot.py

discordbot's People

Contributors

dependabot[bot] avatar usertxt avatar

discordbot's Issues

requirements.txt version conflict

While dockerizing your project:

user.bot  | ERROR: Cannot install -r requirements.txt (line 6) and aiohttp==3.7.4 because these package versions have conflicting dependencies.
user.bot  |
user.bot  | The conflict is caused by:
user.bot  |     The user requested aiohttp==3.7.4
user.bot  |     discord-py 1.1.1 depends on aiohttp<3.6.0 and >=3.3.0
user.bot  |
user.bot  | To fix this you could try to:
user.bot  | 1. loosen the range of package versions you've specified
user.bot  | 2. remove package versions to allow pip attempt to solve the dependency conflict
user.bot  |
user.bot  | ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

No module named discord?

I am so confused now why doesn't this app run sir please help I want to run this bot.
I have python 3.7.3
discord.py 1.1.1 which can easily be changed.
I get error "no module named discord" Error on line 1 ))))

Is there any simple reason or way I can get this to work please thank you.

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.