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.
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
Get the bot secret token and set it in the TOKEN field inside this Python script
Run the script
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()
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
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()
Hello it was working good for months but today i getting this error can anyone help ? @Ryan
Traceback (most recent call last):
File "/home/runner/Discordpy/venv/lib/python3.10/site-packages/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "/home/runner/Discordpy/venv/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
return self.finalize_request(rv)
File "/home/runner/Discordpy/venv/lib/python3.10/site-packages/flask/app.py", line 1842, in finalize_request
response = self.make_response(rv)
File "/home/runner/Discordpy/venv/lib/python3.10/site-packages/flask/app.py", line 2134, in make_response
raise TypeError(
TypeError: The view function for 'index' did not return a valid response. The function either returned None or ended without a return statement.
@Ryan can you whitelist the JellyDix plugin itself? It aint loading for me even without the API url modification, so i guess itās not whitelisted for trsro, right? thanks