forked from RibusDesigns/pineapple
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientWrapper.py
More file actions
26 lines (21 loc) · 836 Bytes
/
ClientWrapper.py
File metadata and controls
26 lines (21 loc) · 836 Bytes
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
import random
import discord
class ClientWrapper(object):
def __init__(self, pm):
self.pluginManager = pm
self.client = pm.client
async def send_message(self, name, channel, message):
em = discord.Embed(description=message, colour=self.get_color(name))
msg = await self.client.send_message(channel, embed=em)
return msg
async def edit_message(self, name, old_message, new_message):
em = discord.Embed(description=new_message, colour=self.get_color(name))
msg = await self.client.edit_message(old_message, embed=em)
return msg
@staticmethod
def get_color(name):
random.seed(name)
r = random.randint(0, 255)
g = random.randint(0, 255)
b = random.randint(0, 255)
return discord.Color((r << 16) + (g << 8) + b)