-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
66 lines (50 loc) · 1.78 KB
/
bot.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import discord
import os
import sys
from create import color_user
from manage import clean_empty_color_roles
from modify import modify_hsv, modify_rgb
intents = discord.Intents.default()
intents.members = True
guild_ids = sys.argv[1:]
bot = discord.Bot(intents=intents)
@bot.event
async def on_ready():
print("Palette Bot is up!")
print(f"We have logged in as {bot.user}")
@bot.slash_command(description="Give your name a random color", guild_ids=guild_ids)
async def colormerandom(ctx: discord.ApplicationContext):
await ctx.defer(ephemeral=True, invisible=False)
await color_user(ctx, ctx.user, os.urandom(3).hex())
@bot.slash_command(description="Give your name a color", guild_ids=guild_ids)
async def colorme(ctx: discord.ApplicationContext, color: str):
await ctx.defer(ephemeral=True, invisible=False)
await color_user(ctx, ctx.user, color)
@bot.slash_command(description="Clean unused colors", guild_ids=guild_ids)
async def cleanbrushes(ctx: discord.ApplicationContext):
await ctx.defer(ephemeral=True, invisible=False)
await clean_empty_color_roles(ctx)
@bot.slash_command(description="Modify your current color", guild_ids=guild_ids)
async def set_hsv(
ctx: discord.ApplicationContext,
hue: float = None,
saturation: float = None,
value: float = None,
):
await ctx.defer(ephemeral=True, invisible=False)
await modify_hsv(ctx, hue, saturation, value)
@bot.slash_command(description="Modify your current color", guild_ids=guild_ids)
async def set_rgb(
ctx: discord.ApplicationContext,
r: float = None,
g: float = None,
b: float = None,
):
await ctx.defer(ephemeral=True, invisible=False)
await modify_rgb(ctx, r, g, b)
bot.run(
os.environ.get(
"DISCORD_TOKEN",
"DISCORD_TOKEN_NOT_FOUND",
)
)