A Discord bot that ensures DMs are always turned off in your Discord
Project description
No-DM Discord Bot
Introduction
This Python package is designed for interacting with the Discord API to enable or disable direct messaging (DM) on a Discord server. It utilizes environment variables for secure and flexible configuration.
Installation
To install and use this package, follow these steps:
- Clone the repository:
git clone [your-repository-url]
- Navigate to the cloned directory:
cd no-dm-discord
- Install required dependencies:
pip install -r requirements.txt
Configuration
Before running the script, you need to set up the following environment variables in a .env file:
DISCORD_BOT_TOKEN: Your Discord bot token.DISCORD_GUILD_ID: The Guild ID of your Discord server.
Example .env file:
DISCORD_BOT_TOKEN=your_bot_token
DISCORD_GUILD_ID=your_guild_id
Usage
Run the script using Python:
python main.py
Getting a Bot Token
To obtain a bot token:
- Visit the Discord Developer Portal.
- Create a new application and add a bot to it.
- Copy the bot token provided.
Setting Up the Bot
Ensure your bot has administrative permissions on the Discord server for it to function correctly.
Getting the Guild ID
To find your Discord server's Guild ID:
- Enable Developer Mode in Discord (Settings -> Advanced -> Developer Mode).
- Right-click your server name and click 'Copy ID'.
Contributing
Contributions to this package are welcome. Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature.
- Commit your changes.
- Push to the branch.
- Open a pull request.
Code Sample
Below is a simple example of how to use this package within your Python project to disable DMs for your Discord server:
from no_dm_discord import update_discord_status
# Ensure your .env file has the DISCORD_BOT_TOKEN and DISCORD_GUILD_ID set
update_discord_status()
print("DMs have been successfully disabled.")
This example assumes you have set up your environment variables correctly and have the no_dm_discord package installed in your environment.
Remember, the actual function call and package import might need to be adjusted based on your package structure and function definitions.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file no-dm-discord-0.1.0.tar.gz.
File metadata
- Download URL: no-dm-discord-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce4405e7f5c2100cfd5d06deda52a56c1b130e136acace5ebcb06836137af4ae
|
|
| MD5 |
22a99f2fa5bf3979acb33236f6ee8d8b
|
|
| BLAKE2b-256 |
77c66f258dace28c23a35f326a70c50fef6167be6fc0609eda67d0260f8a7b13
|
File details
Details for the file no_dm_discord-0.1.0-py3-none-any.whl.
File metadata
- Download URL: no_dm_discord-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f949d02188aa9ef718662fe5f0bcfc7f2c5d1f8a2caadca5ddfe147a2f7facda
|
|
| MD5 |
c700c7e7ad5b3053901d595dd5f11044
|
|
| BLAKE2b-256 |
6383afa895d55f3d7341759c8ef434bea0fe7090e88620f4e88293cf70a07c51
|