예제 #1
0
파일: commands.py 프로젝트: Rettend/BuffBot
    async def bye(self, ctx):
        if not global_methods.is_admin(ctx.message.author):
            await self.bot.say("You're not a big boy")
            return None

        await self.bot.say("Bye bye!")
        await self.bot.logout()
예제 #2
0
    async def blackjack_force_stand(self, ctx) :
        if not global_methods.is_admin(ctx.message.author):
            await self.bot.say("You're not a big boy")
            return None
        for player in self.blackjack_players :
            player['status'] = 1

        await self.blackjack_calculate_winner()
예제 #3
0
파일: voice.py 프로젝트: Dasister/BuffBot
 async def stop_audio(self, ctx):
     if not global_methods.is_admin(ctx.message.author):
         await self.bot.say("You're not a big boy")
         return None
     if self.player:
         self.player.stop()
     else:
         await self.bot.say("I'm not playing anything right now")
예제 #4
0
파일: voice.py 프로젝트: Dasister/BuffBot
 async def play_audio(self, ctx, link):
     if not global_methods.is_admin(ctx.message.author):
         await self.bot.say("You're not a big boy")
         return None
     await self.bot.say("Please use !queue instead..")
     song = link
     # link added to next field in current song
     self.playlist.add_song(song)
     self.seconds_to_next = 0
예제 #5
0
파일: tax.py 프로젝트: Rettend/BuffBot
 async def set_wealth_tax_percentage(self, ctx, wealth_tax_percentage):
     if not global_methods.is_admin(ctx.message.author):
         await self.bot.say("You're not a big boy")
         return None
     user = ctx.message.author
     if float(wealth_tax_percentage) <= 0 or float(wealth_tax_percentage) >= 1:
         await self.bot.say("{}, please enter a valid amount".format(user.mention))
         return None
     self.wealth_tax_percentage = wealth_tax_percentage
     await self.bot.say("Amazing! I'm now collecting {}% of your wealthy money!".format(self.wealth_tax_percentage))
예제 #6
0
파일: tax.py 프로젝트: Rettend/BuffBot
 async def set_tax_percentage(self, ctx, tax_percentage):
     if not global_methods.is_admin(ctx.message.author):
         await self.bot.say("You're not a big boy")
         return None
     user = ctx.message.author  # Used instead of ctx.mention.author to actually tag the author.
     if float(tax_percentage) <= 0 or float(tax_percentage) >= 1:
         await self.bot.say("{}, please enter a valid amount".format(user.mention))
         return None
     self.tax_amount_percentage = tax_percentage
     await self.bot.say("Amazing! I'm now collecting {}% of your income!".format(self.tax_amount_percentage))
예제 #7
0
    async def new_blackjack_game(self, ctx):
        if not global_methods.is_admin(ctx.message.author):
            await self.bot.say("You're not a big boy")
            return None
        if self.blackjack_game_status != 0:
            self.bot.say("A game is already in place.. wait until it is finished.")
            return None,

        self.deck = self.generateCards()
        self.blackjack_game_status = 1
        await self.bot.say("A blackjack table have now opened.. "
                           "please do ``` !bj join <bet> ``` to join the table.")
예제 #8
0
파일: voice.py 프로젝트: Rettend/BuffBot
 async def set_volume(self, ctx, volume: int):
     if not global_methods.is_admin(ctx.message.author):
         await self.bot.say("You're not a big boy")
         return None
     # Ensure the volume argument is between 0 and 100.
     if 0 > volume or volume > 100:
         await self.bot.say("I don't want to blow out your ears")
         return
     # Set the bot's volume value
     self.volume = float(volume/100)
     if self.player:
         # Set the volume to the player if it exists
         self.player.volume = self.volume
     else:
         await self.bot.say("I'm not playing anything right now, but I set the volume to {}% for next time".format(volume))
예제 #9
0
    async def patrol_channels(self, ctx):
        '''Patrol all voice channels from the calling channel.
                This method will go trough every channel and check each user. 
                    -> check if listed game is in the database
                        -> if not: move player to move queue.
                        -> if it is: Do nothing.
        '''

        if not global_methods.is_admin(ctx.message.author):
            await self.bot.say("You're not a big boy")
            return None

        # User is authorised to perform command.. -> now perform actions.

        good_members = []
        move_queue = []  # to store the queue for later to move them.
        jail = self.get_jail(ctx)  # grab the jail, if not jail.. create one.

        # start to check channels.
        for channel in ctx.message.server.channels:
            if channel != jail:
                # If this returns 0, it means that either the room is empty or it isn't a voice channel
                if len(channel.voice_members) != 0:
                    voice_members = channel.voice_members

                    for member in voice_members:  # for each member in the channel
                        if (len(self.database.get_flagged_games(channel_id=channel.id)) > 0) \
                                and self.database.get_flagged_games(channel_id=channel.id)[0] == "free":
                            # member is allowed.
                            pass
                        else:
                            print(self.database.get_flagged_games(channel.id))

                            if member.game not in self.database.get_flagged_games(
                                    channel.id):

                                if (not move_queue.__contains__(member)):
                                    move_queue.append(member)
                                    print("added to move")

                            else:
                                good_members.append(
                                    member.mention
                                )  # Add member too good boy list

        await self.sort_members_to_channels(members=move_queue, jail=jail)
예제 #10
0
    async def flag_channel(self, ctx, free=None):
        if not global_methods.is_admin(ctx.message.author):
            await self.bot.say("You're not a big boy")
            return None
        if (free == "free"):
            # remove all restriction on selected channel and parse in free.
            self.database.remove_flagged_games(
                ctx.message.author.voice.voice_channel.id)

            # add free in as a title.
            self.database.flag_gaming_channel(
                ctx.message.author.voice.voice_channel.id, "free", 1)
            pass

        else:
            self.database.flag_gaming_channel(
                ctx.message.author.voice.voice_channel.id,
                ctx.message.author.game, 1)
        pass
예제 #11
0
    async def start_blackjack_table(self, ctx):
        if not global_methods.is_admin(ctx.message.author):
            await self.bot.say("You're not a big boy")
            return None
        self.blackjack_game_status = 3;
        self.dealerCards = [self.drawCard(), self.drawCard()]
        output = "Welcome to the blackjack room!!! \n"
        output += "Dealers card shown to you fellows is {}\n".format(
            self.dealerCards[0].getStringSymbol() + self.dealerCards[0].getStringValue())
        output += "====================================================\n"
        for player in self.blackjack_players:
            output += "{} has these cards: {}. That's a total score of {}\n" \
                .format(player['user'].mention,
                        player['cards'][0].getStringSymbol() + player['cards'][0].getStringValue()
                        + " " + player['cards'][1].getStringSymbol() + player['cards'][1].getStringValue(),
                        self.blackjack_calculate_card_values(player['cards']))
            pass

        await self.bot.say(output)
        pass
예제 #12
0
파일: commands.py 프로젝트: Rettend/BuffBot
    async def add_smug(self, ctx, path):
        allowed_content = {
            'image/jpeg': 'jpg',
            'image/png': 'png',
            'image/gif': 'gif'
        }
        if not global_methods.is_admin(ctx.message.author):
            await self.bot.say("You're not a big boy")

        async with aiohttp.get(path) as r:
            if r.status == 200:
                file = await r.content.read()
                type = r.headers['Content-Type']
        if type not in allowed_content:
            await self.bot.say("That kind of file is not allowed")
            return
        else:
            hash = hashlib.md5(file).hexdigest()
            filename = "smug-anime-faces/{}.{}".format(hash,
                                                       allowed_content[type])
            with open(filename, 'wb') as f:
                f.write(file)
            await self.bot.say("Smugness levels increased")
예제 #13
0
 async def remove_channel_flags(self, ctx):
     if not global_methods.is_admin(ctx.message.author):
         await self.bot.say("You're not a big boy")
         return None
     self.database.remove_flagged_games(
         ctx.message.author.voice.voice_channel.id)
예제 #14
0
파일: voice.py 프로젝트: Dasister/BuffBot
 async def leaveChannel(self, ctx):
     if not global_methods.is_admin(ctx.message.author):
         await self.bot.say("You're not a big boy")
         return None
     await self.voice.disconnect()
     self.voice = None
예제 #15
0
파일: voice.py 프로젝트: Dasister/BuffBot
 async def peter(self, ctx):
     if not global_methods.is_admin(ctx.message.author):
         await self.bot.say("You're not a big boy")
         return None
     await self.play_music(link=self.playlist.peter())
예제 #16
0
파일: voice.py 프로젝트: Dasister/BuffBot
    async def play_next(self, ctx):
        if not global_methods.is_admin(ctx.message.author):
            await self.bot.say("You're not a big boy")
            return None

        self.seconds_to_next = 0