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.
To install and use this package, follow these steps:
- Clone the repository:
git clone https://github.com/wbnns/disable-dm-discord-guild.git
- Navigate to the cloned directory:
cd no-dm-discord
- Install required dependencies:
pip install -r requirements.txt
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
Run the script using Python:
python main.py
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.
Ensure your bot has administrative permissions on the Discord server for it to function correctly.
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'.
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.
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.
This project is licensed under the MIT License.