-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipc.py
35 lines (28 loc) · 956 Bytes
/
ipc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from discord.ext import commands
class IPC:
def __init__(self, bot):
self.bot = bot
@commands.command()
async def instance(self, ctx):
""" Displays the current instance ID """
await ctx.send(self.bot.instance)
@commands.command(name="global")
@commands.is_owner()
async def global_(self, ctx, command: str, *, args: str):
""" Executes the specified command across the other instances
Command | Arguments | Returns
eval * *
reload cog bool
"""
data = {
'op': 'EXEC',
'id': self.bot.instance,
'd': {
'command': command,
'args': args
}
}
res = await self.bot.conn.send(data, expect_result=True)
await ctx.send(f"```py\n{str(res)}\n```")
def setup(bot):
bot.add_cog(IPC(bot))