示例#1
0
 def AddComponent( self, typeStr, *args, **kwargs ):
     wrprCls = base.game.nodeMgr.GetWrapperByName( typeStr )
     wrpr = wrprCls.Create( *args, **kwargs )
     wrpr.SetDefaultValues()
     wrpr.SetParent( wrpr.GetDefaultParent() )
     
     # Bit of a hack. Sometimes a wrapper can create multiple components 
     # when Create is called. Make sure to set default values on all the 
     # components that were created.
     if hasattr( wrpr, 'extraNps' ):
         for np in wrpr.extraNps:
             eWrpr = base.game.nodeMgr.Wrap( np )
             eWrpr.SetDefaultValues()
     cmds.Add( [wrpr.data] )
     
     return wrpr
示例#2
0
    while True:
        try:
            random_card = randint(0, len(raw_names) - 1)
            card = await get_card_object(raw_names[random_card], card_options,
                                         True, False)
            print(card.rarity)
        except:
            pass


async def deadlythread(message):
    if not tester_check(message):
        return

    loop = asyncio.get_event_loop()
    await loop.run_in_executor(thread_pool, lambda: time.sleep(5000))
    print("Deadly Thread is Deadly No More\n")
    return


###

commands.Add("test.eval%", evalfunc, count=False)
commands.Add("test.diag", diagnostics, count=False)
commands.Add("test.gc", memoryfree, count=False)
commands.Add("test.radio", radio, count=False)
commands.Add("test.except", exception, count=False)
commands.Add("test.sleep", sleep, count=False)
commands.Add("test.raritytest", cardraritytest, count=False)
commands.Add("test.deadlythread", deadlythread, count=False)
示例#3
0
async def report(message):
    if bot.reports_channel == None or bot.reports_guild == None:
        await message.channel.send(
            "Our inbox for Reports are currently closed. Sorry!")
        return

    arguments = commands.GetArgumentsFromCommand(message.content)

    if arguments == False:
        await message.channel.send(
            "Either I'm perfect, or you forgot to type in a bug report.")
        return

    report = ""
    for i in range(0, len(arguments)):
        report = report + arguments[i]
        if i < len(arguments) - 1:
            report = report + bot.argumentSeperator

    await bot.reports_channel.send(":warning: Report Received from '" +
                                   str(message.author) + "':\n'" + report +
                                   "'")
    await message.channel.send(
        "Thank you! I'll try my best to improve the library's services!")
    return


###

commands.Add("report%", report)
示例#4
0
 def add(argv):
     return commands.Add(argv)
示例#5
0
import commands

###

import bot

async def invite(message):
    await message.channel.send("Invite me to your server to use my library's services wherever you'd like!\n<https://discordapp.com/oauth2/authorize?client_id=" + str(bot.client.user.id) + "&scope=bot>")
    return

###

commands.Add("invite", invite)
示例#6
0
            if image_info:
                messageEmbed.set_image(url=image_info.Url)

        try:
            await message.channel.send(embed=messageEmbed)
        except:
            await message.channel.send(
                "I couldn't find anything in my library for '" + query + "'.")


async def search(message):
    await get_search(message, True, False)
    return


async def portrait(message):
    await get_search(message, False, True)
    return


async def lookup(message):
    await get_search(message, True, True)
    return


###

commands.Add("search%", search)
commands.Add("portrait%", portrait)
commands.Add("lookup%", lookup)
示例#7
0
        return "Then I absolutely cannot allow you to see the mistress."
    if random_number == 5:
        return "Drizzle that humidifies the air is the book's worst enemy."
    if random_number == 6:
        return "There have been lots of mice in the library recently."
    if random_number == 7:
        return "I wonder where I put that book?"
    if random_number == 8:
        return "The sky still has colors that I haven't seen after all."


async def info(message):
    true_commands = 0
    for command in commands.commands:
        if command.count:
            true_commands = true_commands + 1

    await message.channel.send(
        aboutMessage %
        (GetSpecialQuote(), sys.version[:sys.version.index('(') - 1],
         str(discord.__version__), round((time() - bot.startTime) / 60, 1),
         round(24 -
               (((time() - bot.startTime) / 60) / 60), 1), str(true_commands),
         str(len(bot.client.guilds)), str(len(bot.radio_players))))
    return


###

commands.Add("info", info)
示例#8
0
    if await Check_Nsfwimage(message):
        await PostImage(message, "explicit", "touhou", "https://gelbooru.com/index.php", True, True)
    return

async def photo(message):
    await PostImage(message, "safe", "touhou", "https://gelbooru.com/index.php", True, False)
    return

async def lewdphoto(message):
    if await Check_Nsfwimage(message):
        await PostImage(message, "questionable", "touhou", "https://gelbooru.com/index.php", True, False)
    return

async def nsfwphoto(message):
    if await Check_Nsfwimage(message):
        await PostImage(message, "explicit", "touhou", "https://gelbooru.com/index.php", True, False)
    return

###

commands.Add("imagewith%", image)
commands.Add("image%", photo)
commands.Add("lewdimagewith%", lewdimage, count=False)
commands.Add("lewdimage%", lewdphoto, count=False)
commands.Add("lewdwith%", lewdimage)
commands.Add("lewd%", lewdphoto)
commands.Add("nsfwimagewith%", nsfwimage, count=False)
commands.Add("nsfwimage%", nsfwphoto, count=False)
commands.Add("nsfwwith%", nsfwimage)
commands.Add("nsfw%", nsfwphoto)
示例#9
0
# ok you can open your eyes again
async def help(message):
    arguments = commands.GetArgumentsFromCommand(message.content)

    if arguments == False:
        await message.channel.send(helpMessage)
    else:
        if arguments[0] == 'music':
            await message.author.send(musicHelpMessage)
            if not isinstance(message.channel,
                              DMChannel):  # Are we not in a DM Channel?
                await message.channel.send(
                    message.author.name +
                    ": There are a LOT of commands! Check your DMs!"
                )  # Tell the User to check them.
        if arguments[0] == 'image' or arguments[0] == 'images':
            await message.channel.send(imageHelpMessage)
    return


'''
async def betahelp(message):
    await message.channel.send(betaHelpMessage)
    return
'''

###

commands.Add("help%", help)
#commands.Add("betahelp", betahelp)
示例#10
0
async def suggest(message):
    if bot.suggestions_channel == None or bot.suggestions_guild == None:
        await message.channel.send(
            "Our inbox for Suggestions are currently closed. Sorry!")
        return

    arguments = commands.GetArgumentsFromCommand(message.content)

    if arguments == False:
        await message.channel.send(
            "Either I'm perfect, or you forgot to type in a suggestion.")
        return

    suggestion = ""
    for i in range(0, len(arguments)):
        suggestion = suggestion + arguments[i]
        if i < len(arguments) - 1:
            suggestion = suggestion + bot.argumentSeperator

    await bot.suggestions_channel.send("Suggestion Received from '" +
                                       str(message.author) + "':\n'" +
                                       suggestion + "'")
    await message.channel.send(
        "Thank you! I'll try my best to improve the library's services!")
    return


###

commands.Add("suggest%", suggest)
示例#11
0
    #await message.channel.send("You've already received your daily card!")
    #return

    card_id = await get_card(message)

    #if await io.write_data("owned_cards-" + str(message.author.id), str(card_id) + ";") == False:
    #await io.edit_data("owned_cards-" + str(message.author.id), str(card_id) + ";", True)

    #if update_daily_cooldown: # Make sure the user got their card before updating their cooldown, just in case
    #await io.edit_data("daily_card_cooldown-" + str(message.author.id), str(time.time()), False) # Update the Cooldown

    return


async def cards(message):
    await get_cards(message)
    return


async def view(message):
    await view_card_handler(message)
    return


###

#commands.Add("daily", daily)
commands.Add("card", daily)
#commands.Add("cards", cards)
#commands.Add("view", view)
示例#12
0
import bot
from time import time
from random import randint


def get_ping_message():
    if randint(0, 99) == 0:
        return "...Wha? Oh, Pong!"

    if int(24 - (((time() - bot.startTime) / 60) / 60)) <= 2:
        return "Yaawn... Oh! Pong!"

    if bot.season == "christmas":
        return "Jingle, jingle! Oh, uh, Pong!"
    if bot.season == "halloween":
        return "Who's there?! Oh, it's just you. Pong!"
    if bot.season == "new year":
        return "Pong, pong! Happy new year!"

    return "Pong!"


async def ping(message):
    await message.channel.send(get_ping_message())
    return


###

commands.Add("ping", ping)