def loadAllData(): print("Loading all 'br data...") with open(assets.get("battleroyale.json"), "r") as f: string = f.read() loadDefaults(string) loadWeaponData(string) loadThrowableData(string) loadCovers(string) print("Done!")
async def lctest(ctx): exception_text = "<#CHAR#o>\"0\"o-1+?>/" font = ImageFont.truetype(assets.get("consola.ttf"), size=32) im = Image.new("RGB", font.getsize(exception_text), (60,50,50,255)) d = ImageDraw.Draw(im) d.text((0,0), exception_text, fill=(255,255,255,255), font=font) im.save("temp-lctest.png", "PNG") await ctx.send(file=discord.File("temp-lctest.png"))
async def dailyCmd(ctx): global latestUpdateUID global wordsDict global wordOfTheDay day = datetime.datetime.now() dayuid = day.year * 365 + day.month * 12 + day.day random.seed(dayuid) if dayuid != latestUpdateUID: latestUpdateUID = dayuid await ctx.send("Updating data, please wait...") with open(assets.get("words_dictionary.json"), "r") as f: wordsDict = json.loads(f.read()) wordOfTheDay = random.choice(list(wordsDict.keys())) wordsDict = None random.seed(dayuid) text = day.strftime("Today is %A, %d of %B %Y!") embed = discord.Embed(title=text, color=0x0b0b73) embed.add_field(name="Number of the day", value=random.randint(1, 99)) embed.add_field(name="Word of the day", value=wordOfTheDay) embed.add_field(name="User of the day", value=random.choice(ctx.guild.members).name) await ctx.send(embed=embed)
def setup(_bot): global nickDict _bot.add_command(bruh) with open(assets.get("messwith.json"), "r") as f: nickDict = json.loads(f.read()) print(nickDict)
def setup(bot): global brData with open(assets.get("simplebr.json")) as f: brData = json.loads(f.read()) bot.add_command(SimpleBRCmd)
async def newClickbaitCmd(ctx: discord.ext.commands.Context, video_title=None): img = Image.new("RGB", (862, 157), color="white") fnt = ImageFont.truetype(assets.get("Roboto-Regular.ttf"), 19, encoding="unic") subtitle_text = ImageFont.truetype(assets.get("Roboto-Regular.ttf"), 13, encoding="unic") d = ImageDraw.Draw(img) # Draw title if video_title is None: video_title = get_clickbait_text() if len(video_title) > 55: video_title = video_title[:55] + "..." d.text((269, 9), video_title, font=fnt, fill=(13, 13, 13)) # Draw channel name d.text((268, 34), ctx.message.author.name, font=subtitle_text, fill=(96, 96, 96)) # Draw verified icon verified_pos = (273 + subtitle_text.getsize(ctx.message.author.name)[0], 36) verified_icon = Image.open(assets.get("verified.png")) img.paste(verified_icon, verified_pos, mask=verified_icon) # Draw views & time posted d.text((verified_pos[0] + 20, 34), "a trillion views xd • 3 femtoseconds ago", font=subtitle_text, fill=(96, 96, 96)) # Draw description description_text = f"{get_clickbait_text(base_node='description', add_bait=False)}\n\n" \ f"{get_clickbait_text(base_node='desc_link', add_bait=False)}..." d.multiline_text((268, 54), description_text, font=subtitle_text, fill=(96, 96, 96)) # Draw thumbnail if len(ctx.message.attachments) > 0: await ctx.message.attachments[0].save(modutil.absolutePath + "/tempcopy.png") thumb = Image.open(modutil.absolutePath + "/tempcopy.png") else: thumb = Image.open(assets.get("defaultthumb.jpg")) thumb = thumb.resize((246, 138), resample=Image.BICUBIC) img.paste(thumb, box=(6, 9)) # Draw timestamp timestamp = Image.open(assets.get("timestamp.png")) img.paste(timestamp, box=(207, 127), mask=timestamp) # Save & send img.save(modutil.absolutePath + "/temp.png") await ctx.send(file=discord.File(modutil.absolutePath + "/temp.png"))
def setup(bot): global jsonDoc with open(assets.get("clickbait.json")) as f: jsonDoc = json.loads(f.read()) bot.add_command(clickbaitCmd) bot.add_command(newClickbaitCmd)
async def epiccmd_easteregg(ctx): global epic_iteration await ctx.send(file=discord.File( assets.get(["epic.jpg", "epic2.jpg"][epic_iteration]))) epic_iteration += 1 epic_iteration %= 2
class ModuleInfo: def __init__(self, filename, modname, cmds, state): self.filename = filename self.name = modname self.commands = cmds self.state = state # Token and bot loading # if parsed_args.debug: # Stylusventer bot = commands.Bot(command_prefix='"' if parsed_args.prefix is None else parsed_args.prefix, description="how are you seeing this????") tokenf = open(assets.get("tokend"), "r") token = tokenf.read() tokenf.close() else: # Styleventer bot = commands.Bot(command_prefix="'" if parsed_args.prefix is None else parsed_args.prefix, description="how are " "you seeing this????") tokenf = open(assets.get("token"), "r") token = tokenf.read() tokenf.close() # Module loading # debug.log("Loading modules...") bot.moduleInfos = []
def setup(bot, **kwargs): global hangmanWords hangmanWordsf = open(assets.get("hangmanWords.txt"), "r") hangmanWords = hangmanWordsf.read().split("\n") hangmanWordsf.close() bot.add_command(hangcmd)
def setup(_bot, **kwargs): global words with open(assets.get("words_dictionary.json"), "r") as f: words = list(json.loads(f.read()).keys()) _bot.add_command(antonCmd)