Skip to content

Instantly share code, notes, and snippets.

@kinostl
Created December 29, 2019 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinostl/df8b325d98176c68d299f184efd987a3 to your computer and use it in GitHub Desktop.
Save kinostl/df8b325d98176c68d299f184efd987a3 to your computer and use it in GitHub Desktop.
Discord-Rhost Relay
import discord
import asyncio
class RhostRelayClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
async def on_message(self, message):
# don't respond to ourselves
if message.author == self.user:
return
# don't respond to webhooks
if message.author.discriminator == '0000':
return
# rhost api update channel
print(message)
# don't mind me I'm just going to use
# A RIDICULOUS AMOUNT OF MEMORY
# to be a relay
# because Discord is a stupid piece of shit
# that constantly demands websockets for anything useful
client = RhostRelayClient()
client.run('DISCORD.TOKEN')
import requests
import os
from discord import Webhook, RequestsWebhookAdapter
hooks={
'com_channel_name':'discord_webhook_url'
}
# Rhost has several registers that you can populate
# When you call the "execscript()" function, it passes the registers to the executed script as environmental variables.
channel = os.environ['MUSHQ_0']
hook = hooks[channel]
webhook = Webhook.from_url(hook, adapter=RequestsWebhookAdapter())
username = os.environ['MUSHQ_1']
message = os.environ['MUSHQ_2']
webhook.send(message, username=username)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment