Giter Site home page Giter Site logo

defcon-1 / discord-utility-bot-in-python Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 27 KB

A discord utility bot written in Python which can perform various tasks within a Discord server.

License: GNU General Public License v3.0

Python 100.00%
bank-identification-number dice-roller discord discord-py hostname-resolver iplocation utility

discord-utility-bot-in-python's Introduction

Discord Utility Bot in Python

This is a Discord Utility bot written in Python by DEFCON. It can be used to perform various tasks within a Discord server.

Current Features:

  • !status - Gives out the status of the bot if it's UP
  • !host <hostname/domain> - Will resolve the IP address of given hostname
  • !ip - Will display the details of the given IP address
  • !bin - Will search and display the result of BIN (Bank Identification Number) of the given 6 digit BIN
  • !dice - Fun command to roll a dice (random number between 1 - 6)
  • !restart - (Owner only) Will restart the bot. Add your own Discord ID in the code on Line 14 to define owner variable.
  • !kill - (Owner only) Will shutdown the bot instantly.

Prerequisites

In order to run this bot, you will need the following:

  • A Discord account and a server to run the bot on
  • A Discord developer account and a bot token (instructions on how to get these can be found in the Discord Developer Guide below)
  • Python 3.6 or higher
  • The following Python libraries:
    • discord.py
    • asyncio
    • requests
    • socket
    • os
    • sys

Setting up the bot

  1. Clone this repository to your local machine using git clone https://github.com/DEFCON-1/Discord-Utility-Bot-in-Python.git
  2. Navigate to the cloned repository in your terminal
  3. Install the required libraries using python3 -m pip install -U discord.py
  4. Edit the utility.py and configure it by adding your own (Owner's) Discord ID on Line 14, Bot's Discord ID on Line 15 and lastly but most important, add your Bot's token on Line 165 that you will acquire from Discord Developer Portal. It will be explained further down this README.
  5. Run the bot using python utility.py

Discord Developer Guide

In order to run a Discord bot, you will need to have a Discord developer account and create a bot. Here are the steps to do so:

  1. Go to the Discord Developer Portal and sign in with your Discord account
  2. Click the "New Application" button
  3. Give your application a name and click "Create"
  4. On the left side of the page, click the "Bot" tab
  5. Click the "Add Bot" button
  6. Click the "Copy" button next to the "Token" field to copy your bot's token. This is what you will use to authenticate your bot and allow it to connect to Discord servers. Make sure to keep this token secret and never share it with anyone
  7. In order to add your bot to a server, you will need the server's ID. You can get this by enabling "Developer Mode" in the Discord app and right-clicking on the server's name. Click "Copy ID" to copy the server's ID

Adding your bot to a server

In order to add your bot to a server, you will need to have the "Manage Server" permission on the server you want to add the bot to. Here are the steps to add your bot to a server:

  1. Go to the Discord Developer Portal and click on your application
  2. On the left side of the page, click the "OAuth2" tab
  3. Under "Scopes", select the "bot" scope
  4. Under "Bot Permissions", select the permissions that your bot will need (e.g. "Send Messages", "Manage Server")
  5. Click the "Copy" button next to the "URL" field to copy the OAuth2 URL
  6. Paste the URL into your browser and select the server you want to add the bot to
  7. Click "Authorize" to add the bot to the server

Customizing the bot

You can customize the behavior of the bot by modifying the code in the utility.py file. The on_message() function is called whenever the bot receives a message, and you can add your own code to perform different actions based on the content of the message. For example, you could add a command that allows users to check the weather by sending a message like !weather city_name.

You can also add additional functions to perform different tasks. For example, you could create a function that retrieves data from an API and sends it back to the user, or a function that allows users to play a game within the Discord server.

To access the Discord API and perform tasks such as sending messages, you will need to use the discord.py library. You can find the documentation for this library here.

Deploying the bot

Once you have customized your bot and tested it locally, you may want to deploy it so that it can run continuously and serve users in your Discord server. There are a few different options for deploying a Discord bot, including:

  • Running the bot on a personal computer or server that is always on
  • Using a service like Heroku to host the bot
  • Using a service like AWS Lambda to host the bot

Each of these options has its own pros and cons, and you will need to choose the one that best fits your needs.

Additional resources

Created by DEFCON

Donate (ETH): 0x3D2d605DE86cAf188f7b06595D14fC6ce1eeC71d

discord-utility-bot-in-python's People

Contributors

defcon-1 avatar

Stargazers

 avatar  avatar

Watchers

 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.