示例#1
0
 async def bdayset(self, ctx, *args):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     if args[0] == "help":
         embed = discord.Embed(title="**`bdayset` help!**", colour=discord.Colour(color))
         embed.add_field(name="Help is here!", value="The correct command is `{0}bdayset MONTH DAY`. If you'd like to check someone's birthday, use `{0}bday USER`".format(prefix))
         await ctx.send(embed=embed)
         return
     if len(args) == 0:
         embed = discord.Embed(title="Error!", colour=discord.Colour(color))
         embed.add_field(name=">:(", value="The correct command is `{0}bdayset MONTH DAY`. If you'd like to check someone's birthday, use `{0}bday USER`".format(prefix))
         embed.set_footer(text="Type `{0}help`".format(prefix))
         await ctx.send(embed = embed)    
     user = ctx.message.author
     combined = " ".join(args) # i.e. 3 Jan
     try:
         if len(args[0]) > 3:
             date = arrow.get(combined, "MMMM D")
             writeFile(combined, ctx, user)
             embed = discord.Embed(title="Birthday set!", colour=discord.Colour(color))
             embed.add_field(name="🎂🎂🎂", value="Set to: **{0}**".format(date.format("MMMM Do")))
             await user.send(embed = embed)
         elif len(args[0]) == 3:
             date = arrow.get(combined, "MMM D")
             writeFile(combined, ctx, user)
             embed = discord.Embed(title="Birthday set!", colour=discord.Colour(color))
             embed.add_field(name="🎂🎂🎂", value="Set to: **{0}**".format(date.format("MMMM Do")))
             await user.send(embed = embed)
     except ValueError:
         embed = discord.Embed(title="Birthday error!", colour=discord.Colour(color))
         embed.add_field(name=">:(", value="Please try again, or type `{}help`".format(prefix))
         await user.send(embed = embed)
示例#2
0
 async def bdayset_error(self, ctx, error):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Error!", colour=discord.Colour(color))
     embed.add_field(name=">:(", value="The correct command is `{0}bdayset MONTH DAY`. If you'd like to check someone's birthday, use `{0}bday USER`".format(prefix))
     embed.set_footer(text="Type `{0}help`".format(prefix))
     await ctx.send(embed = embed)    
示例#3
0
文件: timer.py 项目: spenmich1/timely
 async def cancel_error(self, ctx, error):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Error!", colour=discord.Colour(color))
     embed.add_field(
         name=">:(",
         value="Please try again, or type `{}help`".format(prefix))
     await ctx.send(embed=embed)
示例#4
0
 async def distance(self, ctx):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="**`dis` help!**",
                           colour=discord.Colour(color))
     embed.add_field(
         name="Help is here!",
         value="Correct format is `{0}dis DD/MM/YYY`".format(prefix))
     await ctx.send(embed=embed)
示例#5
0
文件: jokes.py 项目: spenmich1/timely
 async def messages_error(self, ctx, error):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="Whoops!", colour=discord.Colour(color))
     embed.add_field(name="There's been an error",
                     value="Please type `{0}help`".format(prefix))
     await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
示例#6
0
文件: timer.py 项目: spenmich1/timely
 async def timer_error(self, ctx, error):
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="**Syntax Error**",
                           colour=discord.Color(color))
     prefix = get_prefix(bot, ctx.message)
     embed.add_field(name="_**Please try again!**_",
                     value="Example: \n`{}timer 10 seconds`".format(prefix))
     message = await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
示例#7
0
 async def utility(self, ctx):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="Help is here!", colour=color)
     embed.add_field(name=" __**Utility Commands:**__",
                     value=utilityString.format(prefix))
     embed.set_footer(
         text=
         "Only users with Admin permissions can run these commands. Sorry normies."
     )
     await ctx.send(embed=embed)
示例#8
0
文件: jokes.py 项目: spenmich1/timely
 async def movie_error(self, ctx, error):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="Movie search error >:(",
                           colour=discord.Colour(color))
     embed.add_field(
         name="🎞🎞🎞🎞🎞🎞",
         value=
         "**Please retry with a different search input!** \n Syntax is: `{0}movie` `query`"
         .format(prefix))
     await ctx.send(embed=embed)
示例#9
0
文件: jokes.py 项目: spenmich1/timely
 async def qr_error(self, ctx):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="**`qr` help!**",
                           colour=discord.Colour(color))
     embed.add_field(
         name="Help is here!",
         value="Correct format is `{0}qr MESSAGE`".format(prefix))
     message = await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
示例#10
0
文件: jokes.py 项目: spenmich1/timely
 async def hltb_error(self, ctx, error):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Videogame search error >:(",
                           colour=discord.Colour(color))
     embed.add_field(
         name="🎞🎞🎞🎞🎞🎞",
         value=
         "**Please retry with a different search input!** \n Syntax is: `{}hltb Undertale`"
         .format(prefix))
     message = await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
示例#11
0
 async def remind_error(self, ctx, error):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Syntax error >:(",
                           colour=discord.Colour(color))
     embed.add_field(
         name="Correct syntax:",
         value=
         "`{}?remind @user \"message\" time`\ne.g. `{}remind @TimeVibe \"Your message here\" 1 week 10 hours 3 minutes` \n \n *`@user` field is optional if the reminder is for yourself.*"
         .format(prefix, prefix))
     message = await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
示例#12
0
 async def bday(self, ctx, user: discord.Member):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     if user == None:
         embed = discord.Embed(title="Help is here!", colour=discord.Colour(color))
         embed.add_field(name=">:(", value="The correct command is `{0}bday USER`. If you'd like to set your birthday, use `{0}bdayset MONTH DAY`".format(prefix))
         embed.set_footer(text="Type `{0}help`".format(prefix))
         await ctx.send(embed = embed)    
     userID = user.id
     userNick = user.nick
     color = int(get_color(bot, ctx.message))
     with open('files/{}.json'.format(ctx.guild.id), 'r') as file:
         try:
             data = json.load(file)
             birthday = data["usersbday"][str(userID)]
             date = birthday.capitalize()
             embed = discord.Embed(title="{0}'s Birthday:".format(userNick), colour=discord.Colour(color))
             embed.add_field(name="🎂🎂🎂", value="Their birthday is: **{0}**".format(date))
             await ctx.send(embed = embed)
         except KeyError:
             prefix = get_prefix(bot, ctx.message)
             embed = discord.Embed(title="No Birthday Set!", colour=discord.Colour(color))
             embed.add_field(name="🎂🎂🎂", value="{0} doesn't have a birthday set! Use `{1}bdayset MONTH DAY` to set it.".format(userNick, prefix))
             await ctx.send(embed = embed)
示例#13
0
文件: jokes.py 项目: spenmich1/timely
    async def movie(self, ctx, *args):
        prefix = get_prefix(bot, ctx.message)
        if args[0] == "help":
            embed = discord.Embed(title="**`movie` help!**",
                                  colour=discord.Colour(color))
            embed.add_field(
                name="Help is here!",
                value="Correct format is `{0}movie TITLE`".format(prefix))
            await ctx.send(embed=embed)
            return
        search = ("_".join(args))
        response = requests.get(
            "http://www.omdbapi.com/?apikey={0}&t={1}".format(key, search))
        data = json.loads(response.text)
        title = data["Title"]
        released = data["Released"]
        rated = data["Rated"]
        type = data["Type"]
        runtime = data["Runtime"]
        genre = data["Genre"]
        director = data["Director"]
        plot = data["Plot"]
        awards = data["Awards"]
        poster = data["Poster"]
        metascore = data["Metascore"]
        imdbRating = data["imdbRating"]

        stringOne = """**Title:** {0}
        **Date released:** {1}
        **Age rating:** {2}
        **Runtime:** {3}
        **Genre:** {4}
        """.format(title, released, rated, runtime, genre)
        stringTwo = """**Director:** {0}
        **Plot description:** {1}
        **Awards:** {2}
        **Metascore:** {3}
        **IMDB rating:** {4}
        """.format(director, plot, awards, metascore, imdbRating)
        color = int(get_color(bot, ctx.message))
        embed = discord.Embed(title="Movie search: {}".format(title),
                              colour=discord.Colour(color))
        embed.set_thumbnail(url=poster)
        embed.add_field(name="🎞🎞🎞🎞🎞🎞",
                        value=stringOne + stringTwo,
                        inline=True)
        embed.set_footer(text="Many thanks to the OMDB library for the data.")
        await ctx.send(embed=embed)
示例#14
0
 async def tz(self, ctx, input):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     if input == "help":
         embed = discord.Embed(title="**`tz` help!**",
                               colour=discord.Colour(color))
         embed.add_field(
             name="🌍 🌍 🌍",
             value=
             "Set your location with `{}tzset DATE`, or check someone's timezone or the timezone in a location with `{}tz INPUT`"
             .format(prefix, prefix))
         await ctx.send(embed=embed)
         return
     elif input.startswith("<"):
         string = re.sub("<|>|@|!", "", input)
         user = await ctx.bot.fetch_user(int(string))
         embed = discord.Embed(title="**Timezone**",
                               colour=discord.Colour(color))
         with open('files/{}.json'.format(ctx.guild.id), 'r') as file:
             data = json.load(file)
             try:
                 input = data["users"][string]
             except:
                 embed = discord.Embed(title="**Timezone not set**",
                                       colour=discord.Colour(color))
                 embed.add_field(
                     name="🌍 🌍 🌍",
                     value=
                     "User {0} has not set a region! Use `{1}tzset location` to set!"
                     .format(input, prefix))
                 await ctx.send(embed=embed)
                 return
         region, formatted = getRegion(self, input)
         embed.add_field(name="Local time for **" + str(user) + "**",
                         value=formatted)
         await ctx.send(embed=embed)
         return
     else:
         region, formatted = getRegion(self, input)
         embed = discord.Embed(title="**Timezone**",
                               colour=discord.Colour(color))
         embed.add_field(name="Local time in: **" + input.capitalize() +
                         "**",
                         value=formatted)
         await ctx.send(embed=embed)
         return
示例#15
0
 async def data(self, ctx):
     color = int(get_color(bot, ctx.message))
     prefix = get_prefix(bot, ctx.message)
     embed = discord.Embed(title="Help is here!", colour=color)
     embed.add_field(
         name=" __**How we use your data:**__",
         value=
         """By inviting me to your server, you only allow me to access the permissions you agreed on when adding me. I only collect data which you give to me, which inclues your birthday and timezone. 
                     
                     The timezone data is saved as **general regions**, not the location you type in. 
                     
                     The birthday data saves only what you give it, and **doesn't support year of birth** for a reason.
                     
                     The messaging parsing command only temporarily reads the messages in the server, and deletes **any mention** of the messages from it's instant memory as soon as it finishes. 
                     
                     All data saved is deleted upon leaving a server. We use the same hosting servers as many other leading bots who collect far more detailed information on you. """
     )
     await ctx.send(embed=embed)
示例#16
0
 async def convertError(self, ctx, error):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embed = discord.Embed(title="Possible currencies:",
                           colour=discord.Colour(color))
     embed.add_field(name="Syntax",
                     value="`{}convert 10 USD to RUB`".format(prefix),
                     inline=False)
     embed.add_field(name="💸💸💸💸💸💸",
                     value=currenciesFirst,
                     inline=True)
     embed.add_field(name="💸💸💸💸💸💸",
                     value=currenciesSecond,
                     inline=True)
     embed.set_footer(text="Thanks to exchangeratesapi.io for the data!")
     message = await ctx.send(embed=embed)
     await asyncio.sleep(5)
     await message.delete()
示例#17
0
文件: jokes.py 项目: spenmich1/timely
 async def qr(self, ctx, *args):
     color = int(get_color(bot, ctx.message))
     args = "%20".join(args)
     prefix = get_prefix(bot, ctx.message)
     if args[0] == "help":
         embed = discord.Embed(title="**`qr` help!**",
                               colour=discord.Colour(color))
         embed.add_field(
             name="Help is here!",
             value="Correct format is `{0}qr MESSAGE`".format(prefix))
         await ctx.send(embed=embed)
         return
     color = int(get_color(bot, ctx.message))
     url = "http://api.qrserver.com/v1/create-qr-code/?data={}&size=250x250".format(
         args)
     embed = discord.Embed(title="QR Generator:",
                           colour=discord.Colour(color))
     embed.set_image(url=url)
     embed.set_footer(text="Thanks to QRServer for the API!")
     await ctx.send(embed=embed)
示例#18
0
 async def color(self, ctx):
     with open('files/{}.json'.format(ctx.guild.id), 'r') as f:
         color = json.load(f)
     hexa = color["info"]["color"]
     prefix = get_prefix(bot, ctx.message)
     hex_str = hexa
     hex_int = int(hex_str, 16)
     new_int = hex_int + 0x200
     hexa = hexa.replace("0x", "")
     if new_int > 16777215:
         new_int = 16777214
     url = "http://www.thecolorapi.com/id?hex={}".format(hexa)
     response = requests.get(url)
     data = json.loads(response.text)
     image = (data["image"]["named"])
     embed = discord.Embed(title="Color settings!", colour=new_int)
     embed.add_field(
         name="Your current color:",
         value="**#{0}**\nSet a new color with `{1}colorset HEX`".format(
             hex_str.replace("0x", ""), prefix))
     embed.set_thumbnail(
         url="http://www.singlecolorimage.com/get/{}/100x100".format(hexa))
     await ctx.send(embed=embed)
示例#19
0
 async def help(self, ctx, *args):
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     if len(args) == 0:
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Command Categories:**__",
                         value=mainString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "tz":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Timezone Commands:**__",
                         value=tzString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "convert":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Convert Commanbds:**__",
                         value=convertString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "distance":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Distance Commands:**__",
                         value=distanceString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "reminder/timer":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Reminder/Timer Commands:**__",
                         value=reminderString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "birthday":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Birthday Commands:**__",
                         value=birthdayString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "fun":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Fun Commands:**__",
                         value=funString.format(prefix))
         await ctx.send(embed=embed)
     elif args[0] == "utility":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Utility Commands:**__",
                         value=utilityString.format(prefix))
         embed.set_footer(
             text=
             "Only users with Admin permissions can run these commands. Sorry normies."
         )
         await ctx.send(embed=embed)
     elif args[0] == "data":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(
             name=" __**How we use your data:**__",
             value=
             """By inviting me to your server, you only allow me to access the permissions you agreed on when adding me. I only collect data which you give to me, which inclues your birthday and timezone. 
                         
                         The timezone data is saved as **general regions**, not the location you type in. 
                         
                         The birthday data saves only what you give it, and **doesn't support year of birth** for a reason.
                         
                         The messaging parsing command only temporarily reads the messages in the server, and deletes **any mention** of the messages from it's instant memory as soon as it finishes. 
                         
                         All data saved is deleted upon leaving a server. We use the same hosting servers as many other leading bots who collect far more detailed information on you. """
         )
         await ctx.send(embed=embed)
     elif args[0] == "support":
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Support me:**__",
                         value=supportString.format(prefix))
         await ctx.send(embed=embed)
     else:
         embed = discord.Embed(title="Help is here!", colour=color)
         embed.add_field(name=" __**Command Categories:**__",
                         value=mainString.format(prefix))
         await ctx.send(embed=embed)
示例#20
0
文件: jokes.py 项目: spenmich1/timely
 async def messages(self, ctx, *args):
     prefix = get_prefix(bot, ctx.message)
     if args and args[0] == "help":
         embed = discord.Embed(title="**`messages` help!**",
                               colour=discord.Colour(color))
         embed.add_field(
             name="Help is here!",
             value="Correct format is `{0}messages CHANNEL`".format(prefix))
         embed.set_footer(text="`CHANNEL` value is optional.")
         await ctx.send(embed=embed)
         return
     # args[0] should be type discord.TextChannel
     # if args[0] invalid, channel is self
     # args[1] should be int
     # if args[2] doesnt exist, then its number of messages
     # if it does, then its hours/days/etc
     prefix = get_prefix(bot, ctx.message)
     color = int(get_color(bot, ctx.message))
     embedTitle: str
     if args:
         channel = args[0].replace("#", "")
         channel = channel.replace("<", "")
         channel = channel.replace(">", "")
         inChan = ctx.guild.get_channel(int(channel))
     else:
         inChan = ctx.channel
     embedTitle = "Message analyzer for messages in the last 1000 messages in #{}".format(
         inChan)
     messages = await inChan.history(limit=1000).flatten()
     embed = discord.Embed(title="We're thinking....",
                           colour=discord.Colour(color))
     embed.add_field(
         name="🤔🤔🤔",
         value=
         "Depending on how many messages we've gotta go through, this might take a moment..."
     )
     message = await ctx.send(embed=embed)
     color = int(get_color(bot, ctx.message))
     authors = []
     common = []
     authorsStr = []
     c = collections.Counter()
     a = collections.Counter()
     stopWords = stopwords.words("english")
     for i in messages:
         content = (i.content.split())
         for words in content:
             if words.lower() not in stopWords and len(str(words)) >= 4:
                 auth = i.author.id
                 authors.append(auth)
                 c.update(content)
             else:
                 break
     for letter, count in c.most_common(3):
         if letter == None:
             return
         else:
             common.append("** {0} **, used **{1}** times.".format(
                 letter, count))
     a.update(authors)
     for letter, count in a.most_common(3):
         if letter == None:
             return
         else:
             authorsStr.append(
                 "**<@{0}>**, who has sent **{1}** messages".format(
                     letter, count))
     embed = discord.Embed(title=embedTitle, colour=discord.Colour(color))
     print(authorsStr)
     commonString = """
     Most common is {0}
     Secondmost common is {1}
     Thirdmost common is {2}
     """.format(common[0], common[1], common[2])
     authorString = """
     Most messages have been sent by {0}
     In second place is 1
     Third place is held by 2
     """.format(authorsStr[0])
     embed.add_field(name="Most common words:", value=commonString)
     embed.add_field(name="Most active members:", value=authorString)
     await message.edit(embed=embed)