示例#1
0
async def timer(ctx, *, timer_spec: str):
    command_log_info(ctx.message.author.name, "timer", timer_spec)
    channel = {
        "id": ctx.message.channel.id,
        "name": str(ctx.message.channel),
    }
    author = {
        "id": ctx.message.author.id,
        "name": ctx.message.author.name,
    }
    em = clock.on_timer(channel, author, timer_spec)
    if em:
        await ctx.message.channel.send(embed=em)
示例#2
0
async def weather(ctx, *, request_location=None):
    command_log_info(ctx.message.author.name, "weather", str(request_location))
    if request_location is None:
        em = weather_helper_repeat_user(str(ctx.message.author.id),
                                        location_token, open_weather_token)
    else:
        em = weather_helper(
            str(ctx.message.author.id),
            request_location,
            location_token,
            open_weather_token,
        )
    await ctx.message.channel.send(embed=em)
示例#3
0
async def imgur(ctx, *, request_query: str):
    command_log_info(ctx.message.author.name, "imgur", request_query)
    em = imgur_top(request_query, imgur_id)

    # Note: This is not good form but is a quick way to get the intended
    # behavior. Currently discord embeds do not support anything other than
    # image filetypes. Imgur likes to use .mp4 which do not like to be used in
    # embed data types. So if it's a video/mp4 type we just return the string
    # and paste it directly to the channel where discord will embed it by
    # itself. Technically this loses the link to the album which ruins the
    # purpose of embed systems, but its a sacrifice and should be looked into
    # soon.

    if isinstance(em, Embed):
        await ctx.message.channel.send(embed=em)
    elif isinstance(em, str):
        await ctx.message.channel.send(em)
示例#4
0
async def urbanDict(ctx, *args):
    if len(args) == 2 and args[1].isdigit():
        request_definition = args[0]
        numOfDefs = int(args[1])
        command_log_info(
            ctx.message.author.name,
            "multiple urbanDict",
            request_definition + str(numOfDefs),
        )
        em = urbanDict_multiple(request_definition, numOfDefs)
    else:
        request_definition = " ".join(args)
        command_log_info(ctx.message.author.name, "single urbanDict",
                         request_definition)
        em = urbanDict_helper(request_definition)

    await ctx.message.channel.send(embed=em)
示例#5
0
async def uuidGenerator(ctx, *, request_value=0):
    command_log_info(ctx.message.author.name, "uuid", str(request_value))
    em = random_helper("UUID", request_value)
    await ctx.message.channel.send(embed=em)
示例#6
0
async def roll(ctx, *, dice_spec: str = "d2"):
    command_log_info(ctx.message.author.name, "diceRoll", str(dice_spec))
    await ctx.message.channel.send(embed=roll_helper(dice_spec))
示例#7
0
async def thesaurusLookup(ctx, *, request_definition: str):
    command_log_info(ctx.message.author.name, "Thesaurus Lookup",
                     request_definition)
    em = thes_helper(request_definition, webster_thesaurus_token)

    await ctx.message.channel.send(embed=em)
示例#8
0
async def websterLookup(ctx, *, request_definition: str):
    command_log_info(ctx.message.author.name, "Webster Definition",
                     request_definition)
    em = websterDict_helper(request_definition, webster_definition_token)

    await ctx.message.channel.send(embed=em)
示例#9
0
async def wikiLookup(ctx, *, request_definition: str):
    command_log_info(ctx.message.author.name, "Wikipedia Article",
                     request_definition)
    em = wiki_helper(request_definition)

    await ctx.message.channel.send(embed=em)
示例#10
0
async def wolfram(ctx, *, request_query: str):
    command_log_info(ctx.message.author.name, "wolfram", request_query)
    em = wolf_short_query(request_query, wolfram_token)
    await ctx.message.channel.send(embed=em)
示例#11
0
async def au_tier(ctx, *, request_word: str):
    command_log_info(ctx.message.author.name, "au_tier", request_word)
    constructedString = aug_finder(request_word)
    await ctx.message.channel.send(constructedString)
示例#12
0
async def reddit_top(ctx, *, request_subreddit: str):
    command_log_info(ctx.message.author.name, "reddit", request_subreddit)
    em = reddit_top3(request_subreddit)
    await ctx.message.channel.send(embed=em)
示例#13
0
async def d_message(ctx):
    command_log_info(ctx.message.author.name, "d", "d")
    await ctx.message.channel.send("d")
示例#14
0
async def time(ctx, *, query: str):
    command_log_info(ctx.message.author.name, "time", query)
    em = time_helper(query)
    if em:
        await ctx.message.channel.send(embed=em)
示例#15
0
async def stock(ctx, *, query=None):
    command_log_info(ctx.message.author.name, "stock", str(query))
    em = stock_helper(query)
    await ctx.message.channel.send(embed=em)