Created
December 29, 2019 02:11
-
-
Save kinostl/df8b325d98176c68d299f184efd987a3 to your computer and use it in GitHub Desktop.
Discord-Rhost Relay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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