JellyDix Server

This is not a bot plugin. It is a web server that allows you to create your own Discord bot and use the JellyDix plugin to send messages with your bot. It is more for server owners and not players as channel IDs are public and easily found.

Requirements

  1. Windows or Linux will work
  2. Python 3.x (Download Python | Python.org)
  3. Python packages (pip3 install discord.py flask)
  4. Discord bot token (https://discordapp.com/developers/applications/)
  5. ca-certificates package if on Linux

Guide

  1. Create a Discord bot
  2. Invite it to your server with scope bot and the following permissions:
    • Send Messages
    • Attach Files
    • Mention Everyone
    • Embed Links
    • Add Reactions
    • more permissions may be required in the future if JellyDix is updated
  3. Get the bot secret token and set it in the TOKEN field inside this Python script
  4. Run the script
  5. Replace the URL in JellyDix with http://127.0.0.1:5000

If you see SSL verification errors it means you’re missing certificates for verification and you will need to edit the code to use a specific file. I have only encountered this issue on Server 2008 R2 so far.

Code

import requests
import io
import json
import discord
import queue
from discord.ext import commands
from flask import Flask
from flask import request
from threading import Thread
from time import sleep

TOKEN = ''
KEY = 'JellyDix'

bot = commands.Bot(command_prefix='!')
app = Flask(__name__)
q = queue.Queue()

async def message_task():
	global q
	try:
		while not q.empty():
			m = q.get()
			await bot.get_channel(m['id']).send(m['message'])
	except Exception as e:
		print(e)

@app.route('/api', methods=['POST'])
def index():
	global q
	try:
		if request.method == 'POST':
			k = request.json['key']
			channel = int(request.json['channel'])
			message = request.json['message']

			if k == KEY:
				q.put({'id': channel, 'message': message.replace('@', '@ ')})
				bot.loop.create_task(message_task())
				return 'success'
	except Exception as e:
		print(e)
	return 'error'

def flask_thread():
	app.run(debug=False, host='0.0.0.0')

def main():
	th = Thread(target=flask_thread)
	th.start()
	bot.run(TOKEN)
	th.join()

main()
2 Likes

Rewrote to use discord.py.

ty <3

@Ryan @JellyBitz

I completed all the steps,bot online,token copied in python and etc…

i taking this error in bot log:

“Plugin: Error loading url [HTTP Error 404: NOT FOUND] to Notify”

and taking this error in CMD screen

“127.0.0.1 - - [21/Jan/2021 23:58:58] “←[33mPOST /api/notify HTTP/1.1←[0m” 404 -”

I think Flask module havent any problem.But I couldn’t find this shit ^^

i remember engels had this error formerly.if your help to me i would be grateful :slight_smile:

This is very old now and may not work with the latest version of the plugin.

So only Engels know last codes… @JellyBitz help me mate

The only difference I can see is about the json key now called token which is sent by plugin like a password.

Problem solved thanks :heartbeat:

Can you please tell how you fixed it? @GAUCHE
[01:46:56] Plugin: Error loading url [HTTP Error 404: NOT FOUND] to Notify
@Ryan please could you help with this error?

Can Anyone help me
Plugin: Error loading url [<urlopen error [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte>] to Notify

its still work u just need edit 2 line like there
vvvvvv

import requests
import io
import json
import discord
import queue
from discord.ext import commands
from flask import Flask
from flask import request
from threading import Thread
from time import sleep

TOKEN = ''
KEY = 'JellyDix'

bot = commands.Bot(command_prefix='!')
app = Flask(__name__)
q = queue.Queue()

async def message_task():
	global q
	try:
		while not q.empty():
			m = q.get()
			await bot.get_channel(m['id']).send(m['message'])
	except Exception as e:
		print(e)

@app.route('/api/notify', methods=['POST'])
def index():
	global q

	try:
		if request.method == 'POST':
			k = request.json['token']
			print(k)
			channel = int(request.json['channel'])
			print(channel)
			message = request.json['message']
			print(message)
			if k == KEY:
				print('put')
				q.put({'id': channel, 'message': message.replace('@', '@ ')})
				bot.loop.create_task(message_task())
				return 'success'
	except Exception as e:
		print(e)
	return 'error'

def flask_thread():
	app.run(debug=False, host='0.0.0.0')

def main():
	th = Thread(target=flask_thread)
	th.start()
	bot.run(TOKEN)
	th.join()

main()

And change URL
In plugin jellydix in token u need paste JellyDix

Edit:
for ppl who don’t use python u need have a python instaled with a libraries.
if u don’t know what is this just don’t try or goole this.

Well, somebody maybe can help me…

i got in JellyDix Plugin this error:
[17:30:47] Plugin: Error reading response from server [Expecting value: line 1 column 1 (char 0)]

in Terminal of server.py i got this

JellyDix
866364496518840330
||17:30:46|| [Guild] ****: .
put
127.0.0.1 - - [21/Jan/2022 17:30:47] “POST /api/notify HTTP/1.1” 200 -

u bot is online when u run serve?
bot have permision?

Seems that the intent approach has changed in the discord API, so I fixed it. I have as well fixed the response from the JellyDix Server to the bot (bot now understands the response correctly). And I’ve modified how TOKEN is used in the code. Here’s my updated version of the code:

import requests
import io
import json
import discord
import queue
from discord.ext import commands
from flask import Flask
from flask import request
from threading import Thread
from time import sleep

TOKEN = '<YOUR DISCORD BOT TOKEN GOES HERE>'
#KEY = ''

bot = commands.Bot(command_prefix='!',intents=discord.Intents.all())
app = Flask(__name__)
q = queue.Queue()

async def message_task():
	global q
	try:
		while not q.empty():
			m = q.get()
			await bot.get_channel(m['id']).send(m['message'])
	except Exception as e:
		print(e)

@app.route('/api/notify', methods=['POST'])
def index():
	global q

	try:
		if request.method == 'POST':
			k = request.json['token']
		   
			channel = int(request.json['channel'])
				 
			message = request.json['message']
				 
			if k == TOKEN:
				print(message[message.find("|"):message.rfind("|")+1]+ " - Message sent to Discord channel")
				q.put({'id': channel, 'message': message.replace('@', '@ ')})
				bot.loop.create_task(message_task())
				return {"success":True}
	except Exception as e:
		print(e)
		return {"success":False, "message":"Something went wrong, the message was not sent"}

def flask_thread():
	app.run(debug=False, host='0.0.0.0')

def main():
	th = Thread(target=flask_thread)
	th.start()
	bot.run(TOKEN)
	th.join()

main()