예제 #1
0
 async def addHug(self, ctx, *, url: str = ""):
     util.nullifyExecute()
     perms = await util.check_perms(self, ctx)
     if not perms:
         return
     pics = util.load_js(os.path.join("assets", "hug.json"))
     if url == "":
         await self.bot.say("Please provide a url.")
     elif not url.startswith("http"):
         await self.bot.say("Please provide a valid url.")
     elif url.startswith("https://i.imgur.com/"):
         pics.append(url)
         util.save_js("assets/hug.json", pics)
         await self.bot.say("Successfully added " + link + " to hugs.json")
     else:
         try:
             payload = {"image": url, "type": "URL"}
             headers = {"Authorization": "Client-ID 2397de93cc488b8"}
             r = requests.post("https://api.imgur.com/3/image",
                               headers=headers,
                               data=payload)
             link = r.json()["data"]["link"]
             pics.append(link)
             util.save_js("assets/hug.json", pics)
             await self.bot.say("Successfully added " + link +
                                " to hugs.json")
         except:
             await self.bot.say("nope")
예제 #2
0
    async def blacklist(self,
                        ctx,
                        member: discord.Member,
                        *,
                        reason: str = "None given."):
        util.nullifyExecute()
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        if len(self.blacklistList) == 0:
            self.blacklistList = []

        for user in self.blacklistList:
            if str(member.id) == str(user["id"]):
                await self.bot.say(
                    "{} is already in the bot's blacklist.".format(member.name)
                )
                return

        self.blacklistList.append({"id": member.id, "reason": reason})
        util.save_js("blacklist.json", self.blacklistList)

        await self.bot.say(
            "**{}**, you have been blacklisted from using the bot.  Reason: {}"
            .format(member.mention, reason))
예제 #3
0
파일: mod.py 프로젝트: SaturnSH2x2/BepisBot
    async def listNote(self, ctx, member : discord.Member, *, note : str = None):
        util.nullifyExecute()
        perms = await util.check_perms(self, ctx)
        if not perms:
            return
        serverNoteList = util.load_js(os.path.join("notes", "{}.json".format(ctx.message.server.id)))
        if note==None:
            output="`"
            if member.id not in serverNoteList or serverNoteList[member.id]["noteNum"]==0:
                await self.bot.say("That user doesn't have any notes.")
                return
            noteNum=str(serverNoteList[member.id]["noteNum"])
            for i in range(1,int(noteNum)+1):
                output+=str(serverNoteList[member.id]["name"][str(i)]+" {} ".format(member.id)+str(serverNoteList[member.id]["time"][str(i)])+" "+str(serverNoteList[member.id]["issuerName"][str(i)])+" "+str(serverNoteList[member.id]["issuer"][str(i)])+" "+str(serverNoteList[member.id]["note"][str(i)]))+"\n"
            output=output[:-1]
            output+="`"
            await self.bot.say(output)
            return
        if member.id not in serverNoteList or serverNoteList[member.id]["noteNum"]==0:
            await self.bot.say("That user doesn't have any notes.")
            return
        try:
            loggedNote = serverNoteList[member.id]["note"][note]
            loggedName = serverNoteList[member.id]["name"][note]
            loggedTime = serverNoteList[member.id]["time"][note]
            loggedIssuer = serverNoteList[member.id]["issuer"][note]
            loggedIssuerName=serverNoteList[member.id]["issuerName"][note]
            await self.bot.say(loggedIssuerName+""" made a note about """+loggedName+""" on """+loggedTime+""" that said
`"""+loggedNote+"""`""")
        except KeyError:
            await self.bot.say("That note does not exist")
예제 #4
0
    async def spam(self, ctx, number: int, *, thing):
        util.nullifyExecute()
        """Spam a message.  Use with caution."""
        if ctx.message.author.id == self.bot.user.id:
            return

        if self.kSpam == True:
            return

        if len(ctx.message.role_mentions) > 0:
            await self.bot.say("The bot cannot spam role mentions.")
            return

        await self.bot.type()

        if number > 100000000000000000000:
            await self.bot.say("Are you f*****g out of your mind?")
            return
        if number > 100:
            await self.bot.say("Yeah, no.")
            return

        for i in range(number):
            if self.kSpam == True:
                break

            await self.bot.say(thing)

            if i == number - 1:
                pass
            else:
                await self.bot.type()
            await asyncio.sleep(0.75)
예제 #5
0
    async def disableCommand(self, ctx, passedCommand: str):
        util.nullifyExecute()
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        disabledCommands = util.load_js("disabled-commands.json")
        if len(disabledCommands) == 0:
            disabledCommands = []

        if passedCommand == "disableCommand" or passedCommand == "enableCommand":
            await self.bot.say("That command cannot be disabled.")
            return

        for command in self.bot.commands:
            if command == passedCommand:
                disabledCommands.append({
                    "command": passedCommand,
                    "server-id": ctx.message.server.id
                })
                util.save_js("disabled-commands.json", disabledCommands)
                await self.bot.say("{}{} has been disabled.".format(
                    self.bot.command_prefix, passedCommand))
                return

        await self.bot.say("The {}{} command does not exist!".format(
            self.bot.command_prefix, passedCommand))
예제 #6
0
    async def leaveServer(self, ctx):
        util.nullifyExecute()
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        await self.bot.say("Leaving server.  Bye... :cry:")
        await self.bot.leave_server(ctx.message.server)
예제 #7
0
    async def embed(self, ctx, u: str):
        util.nullifyExecute()
        """Embeds a picture so we don't have to look at a big, ugly URL."""
        e = discord.Embed()
        e.set_image(url=u)

        await self.bot.delete_message(ctx.message)
        await self.bot.say(embed=e)
예제 #8
0
    async def no(self):
        util.nullifyExecute()
        """no"""
        if random.randint(1, 25) == 13:
            fil = "no u"
        else:
            fil = "no"

        await self.bot.say(fil)
예제 #9
0
    async def soon(self):
        util.nullifyExecute()
        """shitty hacker meme"""
        if random.randint(1, 25) == 13:
            fil = "uu"
        else:
            fil = "oo"

        await self.bot.say("S{}n:tm:".format(fil))
예제 #10
0
    async def ship(self, mem1: str, mem2: str):
        util.nullifyExecute()
        """Ship two people together to create a fanfiction.  Slightly disturbing material may arise out of this.  You have been warned."""
        fanfics = util.load_js("cogs/fanfics.json")

        message = fanfics[random.randint(0, len(fanfics) - 1)]
        msgFormatted = message.format(mem1, mem2)
        print(msgFormatted)
        await self.bot.say(msgFormatted)
예제 #11
0
    async def say(self, ctx, *, thing):
        util.nullifyExecute()
        """Have the bot say something.  Chances are, you're gonna make it say something stupid."""
        #thing = ctx.message.content[len(ctx.prefix) + len(ctx.command.name) + 1:]

        if ctx.message.author.id == self.bot.user.id:
            return

        await self.bot.say(thing)
예제 #12
0
    async def restart(self, ctx):
        util.nullifyExecute()
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        await self.bot.say(":ballot_box_with_check: BepisBot is restarting...")
        await asyncio.sleep(1)
        await self.bot.close()
        os.system("python3.5 main.py")
예제 #13
0
 async def inviteLink(self, ctx):
     util.nullifyExecute()
     """Invite the bot to your own server!  Sends you a DM with the invite link."""
     perms = await util.check_perms(self, ctx)
     if not perms:
         return
     client_id = util.load_js("config.json")["client-id"]
     await self.bot.whisper(
         "https://discordapp.com/oauth2/authorize?&client_id={0}&scope=bot&permissions=0"
         .format(client_id))
예제 #14
0
 async def pat(self, ctx, member: discord.Member):
     util.nullifyExecute()
     await self.bot.send_typing(ctx.message.channel)
     adjectives = ["gently", "lightly", "meekly"]
     adjToUse = random.choice(adjectives)
     if member == self.bot.user:
         await self.bot.say("*pats myself on head*")
     else:
         await self.bot.say("*{} pats <@!{}> on the head*".format(
             adjToUse, member.id))
예제 #15
0
파일: mod.py 프로젝트: SaturnSH2x2/BepisBot
 async def hashNote(self,ctx):
     util.nullifyExecute()
     perms = await util.check_perms(self, ctx)
     if not perms:
         return
     if ctx.message.author.id == self.bot.user.id:
         return
     serverNoteList = util.load_js(os.path.join("notes", "{}.json".format(ctx.message.server.id)))
     hashed=hashlib.sha256(str(serverNoteList).encode("utf-8")).hexdigest()
     await self.bot.say(hashed)
예제 #16
0
    async def setNick(self, ctx, *, nick: str):
        util.nullifyExecute()
        """Nickname test"""
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        botMember = ctx.message.server.get_member(self.bot.user.id)
        await self.bot.change_nickname(botMember, nick)
        await self.bot.say("Set nickname to {}".format(nick))
예제 #17
0
파일: mod.py 프로젝트: SaturnSH2x2/BepisBot
 async def kick(self, ctx, member : discord.Member):
     util.nullifyExecute()
     """Kick a member from a server.  This requires special perms."""
     perms = await util.check_perms(self, ctx)
     print(perms)
     if (perms):
         try:
             await self.bot.kick(member)
             await self.bot.say("{} has been kicked from the server.".format(member.name))
         except:
             await self.bot.say("Could not kick member.  This might be a permissions issue.")
예제 #18
0
    async def deleteMessages(self, ctx, number: int = 10):
        util.nullifyExecute()
        """Delete the number of messages specified.  Deletes 10 by default.  This requires special perms."""
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        await self.bot.purge_from(ctx.message.channel, limit=number)
        msg = await self.bot.say("Deleted {} messages.".format(number))
        await asyncio.sleep(5)
        await self.bot.delete_message(msg)
예제 #19
0
    async def shutdown(self, ctx):
        util.nullifyExecute()
        """Shutdown the bot.  Useful.  Occasionally."""
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        await self.bot.say(
            ":ballot_box_with_check: BepisBot is shutting down...")
        await asyncio.sleep(1)
        await self.bot.close()
예제 #20
0
    async def disableLogging(self, ctx):
        util.nullifyExecute()
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        logLog = util.load_js("logs/server-list.json")
        logLog.remove(ctx.message.server.id)
        util.save_js("logs/server-list.json", logLog)

        await self.bot.say("Logging for this server has been disabled.")
예제 #21
0
    async def whisper(self, ctx, *, thing):
        util.nullifyExecute()
        """Make it so that it looks like the bot said something on its own."""
        #thing = ctx.message.content[len(ctx.prefix) + len(ctx.command.name) + 1:]

        if ctx.message.author.id == self.bot.user.id:
            return
        try:
            await self.bot.delete_message(ctx.message)
        except:
            pass
        await self.bot.say(thing)
예제 #22
0
    async def killSpam(self, ctx):
        util.nullifyExecute()
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        self.kSpam = True
        await self.bot.say(
            "Spam killed.  All spam commands will be ignored for the next minute."
        )
        await asyncio.sleep(60)
        self.kSpam = False
예제 #23
0
파일: mod.py 프로젝트: SaturnSH2x2/BepisBot
 async def listWarns(self, ctx, member : discord.Member):
     util.nullifyExecute()
     perms = await util.check_perms(self, ctx)
     if not perms:
         return
     serverWarnList = util.load_js(os.path.join("warns", "{}.json".format(ctx.message.server.id)))
     if member.id not in serverWarnList or serverWarnList[member.id]==0:
         await self.bot.say("<@!{}> does not currently have any warns.".format(member.id))
     elif serverWarnList[member.id]>=self.MAXWARNS:
         await self.bot.say("<@!{}> recieved ".format(member.id)+str(self.MAXWARNS)+" warnings and was banned.")
     else:
         await self.bot.say("<@!{}> currently has ".format(member.id)+str(serverWarnList[member.id])+" warnings. They will be banned if they recieve "+str(self.MAXWARNS-serverWarnList[member.id])+" more.")
예제 #24
0
    async def enableExplanations(self, ctx):
        util.nullifyExecute()
        """Enable explanations when doing Tarot Readings."""
        if ctx.message.server.id not in self.server_decks:
            self.server_decks[ctx.message.server.id] = {}

        self.server_decks[ctx.message.server.id]["explanations-enabled"] = True
        util.save_js("server-deck-tarot.json", self.server_decks)

        await self.bot.say(
            ":thumbsup: OK, explanations will be enabled when doing tarot readings."
        )
예제 #25
0
    async def updateBot(self, ctx):
        util.nullifyExecute()
        """Update the bot to the latest version.  This requires special perms."""
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        await self.bot.say("Updating the bot...")
        os.system("git fetch origin")
        os.system("git checkout --force origin/master")
        await self.bot.say("Bot is updated!  Restarting...")
        await self.bot.close()
        os.system("python3.5 main.py")
예제 #26
0
파일: mod.py 프로젝트: SaturnSH2x2/BepisBot
 async def backupNote(self, ctx, *, text : str = None):
     util.nullifyExecute()
     perms = await util.check_perms(self, ctx)
     if not perms:
         return
     if ctx.message.author.id == self.bot.user.id:
         return
     if text == None:
         await self.bot.upload(os.path.join("notes", "{}.json".format(ctx.message.server.id)))
     else:
         serverNoteList = util.load_js(os.path.join("notes", "{}.json".format(ctx.message.server.id)))
         noteListRaw=[serverNoteList[i:i+1750] for i in range(0, len(serverNoteList), 1750)]
         for i in range(len(noteListRaw)):
             await self.bot.say(noteListRaw[i])
예제 #27
0
	async def mikeWazowski(self, ctx):
		util.nullifyExecute()
		if self.voice == None:
			await self.bot.say("Connect to a voice channel, call me with {}join, then call this command.".format(self.bot.command_prefix))
			return
		elif ctx.message.server.get_member(ctx.message.author.id).voice.voice_channel != self.voice.channel:
			await self.bot.say("You're in a different voice channel!  Either switch channels, or use {}join to summon me there.".format(self.bot.command_prefix))
			return
			
		await self.bot.type()
		mw = await self.voice.create_ytdl_player("https://youtu.be/IRP-2y43BLo")
		mw.start()
		
		await self.bot.say("**_M I K E  W A Z O W S K I_**")
예제 #28
0
    async def giveRole(self, ctx, member: discord.Member, role: discord.Role):
        util.nullifyExecute()
        """Give someone a role.  This requires special perms."""
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        try:
            await self.bot.add_roles(member, role)
            await self.bot.say("{} has been given the {} role.".format(
                member.display_name, role.name))
        except:
            await self.bot.say(
                "Could not add role.  This might be a permissions issue.")
예제 #29
0
    async def removeRole(self, ctx, member: discord.Member,
                         role: discord.Role):
        util.nullifyExecute()
        """Revoke a role from someone.  This requires special perms."""
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        try:
            await self.bot.remove_roles(member, role)
            await self.bot.say("{} has had the {} role revoked.".format(
                member.display_name, role.name))
        except:
            await self.bot.say(
                "Could not remove role.  This might be a permissions issue.")
예제 #30
0
    async def setUsername(self, ctx, *, name: str):
        util.nullifyExecute()
        """Set the bot's username.  This requires special perms."""
        perms = await util.check_perms(self, ctx)
        if not perms:
            return

        try:
            await self.bot.edit_profile(username=name)
            await self.bot.say(
                "Henceforth, I shall be known as {}!".format(name))
        except discord.errors.HTTPException:
            await self.bot.say(
                "Hrm?  Something came up; the profile can't be set.")
        except:
            await self.bot.say("Something went wrong.  Sorry.")