https://github.com/gamemann/discord-global-chat
Discord bot that syncs global chats.
https://github.com/gamemann/discord-global-chat
bot channels chat discord discord-bot discord-bots discord-py discordbot discordpy examples globalchat link python sqlite
Last synced: 2 months ago
JSON representation
Discord bot that syncs global chats.
- Host: GitHub
- URL: https://github.com/gamemann/discord-global-chat
- Owner: gamemann
- License: mit
- Created: 2021-04-01T04:31:19.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-12T21:10:19.000Z (about 2 years ago)
- Last Synced: 2025-02-28T12:30:41.743Z (3 months ago)
- Topics: bot, channels, chat, discord, discord-bot, discord-bots, discord-py, discordbot, discordpy, examples, globalchat, link, python, sqlite
- Language: Python
- Homepage: https://moddingcommunity.com/forums/topic/42-discord-global-chat-channels
- Size: 92.8 KB
- Stars: 26
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Discord Global Chat
## Description
A Discord bot that allows for global chat between Discord servers in certain channels. Used for the Unnamed Discord community brand.## Requirements
The Discord.py [package](https://pypi.org/project/discord.py/) is required in order to use this bot. You may install this via the following command.```
python3 -m pip install -U discord.py
```### Enable Intents
You must enable intents within the Discord Developers portal under your project's "Bot" tab. You should only need "Server Members Intent", but I've enabled all three just in-case.
## Command Line Usage
You may specify the settings JSON (used for the bot token, etc) and the SQLite DB location within the command line. The default settings location is `/etc/dgc/settings.json` and the default SQLite DB location is `/etc/dgc/dgc.db`.The following are examples of how to set these in the program.
```
python3 src/main.py cfg=/home/cdeacon/settings.json sqlite=/home/cdeacon/dgc.db
```## Config
The config file is in JSON format and the following keys are supported.* **BotToken** - The Discord bot token. Please retrieve this from the Discord Developers page for your bot.
* **BotMsgStayTime** - When the bot replies to a command in a text channel, delete the bot message this many seconds after (default - **10.0** seconds).
* **UpdateTime** - How often to update the channel and web hook URL cache in seconds (default - **60.0** seconds).## Bot Commands
The command prefix is `!`. You must execute these commands inside of a text channel of the guild you want to modify. You must also be an administrator in order to use these commands.### dgc_linkchannel
```
!dgc_linkchannel
```Adds a channel to the linked global chat. If the channel ID is left blank, it will choose the channel the message was sent in.
### dgc_unlinkchannel
```
!dgc_unlinkchannel
```Unlinks a channel to the linked global chat.
### dgc_updatehook
```
!dgc_updatehook
```Updates the web hook that messages send to within the current guild. This must be pointed towards the correct channel ID set with `dgc_linkchannel`.
## Installing
You may use `make install` within this directory to create the `/etc/dgc/` directory and copy `settings.json.example` to `/etc/dgc/settings.json`. Please configure the `settings.json` file to your needs.Other than that, the needed SQLite tables are created if they don't exist when the Python program is started. However, if need to be, here is the current table structure.
```SQL
CREATE TABLE IF NOT EXISTS `channels` (guildid integer PRIMARY KEY, channelid integer, webhookurl text)
```## Starting
As of right now, you'll want to use `python3` against the `src/main.py` file. Something like the following should work.```bash
python3 src/main.py
```If there's a better way to handle this, please let me know.
## Credits
* [Christian Deacon](https://github.com/gamemann)