Creating Bot acc: https://discordpy.readthedocs.io/en/latest/discord.html
API needed: https://discordpy.readthedocs.io/en/...tml#installing
HZM_Warden(if you are lazy and want to copypaste also some other things): https://github.com/Crimewavezz/HZM_Warden
import discord
import socket
from discord.ext import commands
DISCORD_BOT_TOKEN = "whateva"
#client = commands.Bot()
bot = commands.Bot(command_prefix='!')
#=========================================================================
@bot.command(name = 'rcon', help = 'Syntax: !rcon <ip> <port> <password> <command> <arg1(optionally)>')
async def rcon(ctx, ip=None, port=None, password=None, command=None, arg1=None):
#=========================================================================
if ip is None or port is None or password is None or command is None:
await ctx.send('One or more arguments are missing, type `!help` to check the syntax.')
return
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.connect((ip, int(port)))
if arg1 != None:
sock.send(b"\xFF\xFF\xFF\xFF\x02rcon " + str.encode(password) + b" " + str.encode(command) + b" " + str.encode(arg1))
else:
sock.send(b"\xFF\xFF\xFF\xFF\x02rcon " + str.encode(password) + b" " + str.encode(command))
receive = sock.recv(65565)
embed = discord.Embed(title = "HZM Breakthrough Co-Op Server")
embed.add_field(name = "Response:", value = str(receive, 'utf-8', 'ignore'), inline = True)
await ctx.send(embed = embed)
sock.close()
bot.run(DISCORD_BOT_TOKEN)
Results: