Beispiel #1
0
    def __init__(self, author: Player, community: ChatCommunity,
                 receiver: Player, content: str, client: 'aiotfm.Client'):
        super().__init__(author, content, client)

        self.receiver: Player = receiver
        self.community: ChatCommunity = ChatCommunity(community)
        self.sent: bool = self.author == client.username
Beispiel #2
0
    async def on_whisper(self, _message):
        author = str(_message.author)
        commu = ChatCommunity(_message.community).name
        message = _message.content
        args = message.split()

        print(f"[Whisper][{commu}][{author}] {message}")

        # Whispers commands
        if author in client_admins:
            level = client_admins[author]
            # Level 0 Admins only
            if level == 0:
                if args[0] == "!ban":
                    if len(args) > 1:
                        await self.sendCommand('ban ' + args[1])
                    return
                elif args[0] == "!target":
                    if len(args) > 1:
                        self.elim_target = args[1]
                    return
                elif args[0] == '!press6':
                    await self.sendSmiley(5)
                    return
                elif args[0] == '!press3':
                    await self.sendSmiley(2)                
                    return
                elif args[0] == '!dance':
                    await self.playEmote(0)
                    return
                elif args[0] == "!callback":
                    self.can_press_callback = not self.can_press_callback
                    return
                elif args[0] == "!room":
                    if len(args) > 1:
                        room = ' '.join(args[1:])
                        return await self.joinRoom(room)
                    return await _message.reply(self._room.name)
                elif args[0] == "!pwroom":
                    if len(args) == 1:
                        return
                    return await self.joinRoom(" ".join(args[2:]), args[1])
                elif args[0] == "!canplay":
                    self.can_play, self.is_playing = not self.can_play, False
                    return self.cancel_mov_task()
                    return await self._mort()
                elif args[0] == "!candie":
                    self.can_die = not self.can_die
                    return
                elif args[0] == "!cheese":
                    return await self._cheese()
                elif args[0] == "!win":
                    return await self._win()
                elif args[0] == "!del":
                    code = str(self._room.map.code)
                    if len(args) > 1:
                        code = args[1]
                    return await self.del_map(author, code)
                elif args[0] == "!inv":
                    self.can_accept_inv = not self.can_accept_inv
                    return

            # Level 0+ Admins
            if level >= 0:
                if args[0] == "!lua":
                    if len(args) > 1:
                        if "pastebin" not in args[1]:
                            return await _message.reply("[Error] Code must be hosted on Pastebin")
                        await self.run_code(args[1])
                    return
                elif args[0] in ["!come", "!follow", "!seg"]:
                    target = author
                    if len(args) > 1:
                        target = args[1]

                    tribe = await self.getTribe(disconnected=False)
                    if tribe is not None:
                        member = tribe.get_member(target)
                        if member is not None and member.room is not None:
                            return await self.joinRoom(member.room)
                    if self.friends is not None:
                        friend = self.friends.get_friend(target)
                        if friend is not None and friend.room is not None:
                            return await self.joinRoom(friend.room)
                    return await _message.reply("Player not found")
                elif args[0] == "!commu":
                    commu = 1
                    if len(args) > 1:
                        try:
                            commu = Community(int(args[1]))
                        except:
                            commu = Community[args[1]]
                    self.community = commu
                    return loop.create_task(self.restart())
                elif args[0] == "!say":
                    return await self.sendRoomMessage(" ".join(args[1:]))
                elif args[0] in ["!th", "!house"]:
                    return await self.enterTribe()
                elif args[0] == "!lua":
                    if len(args) == 1:
                        return
                    return await self.run_code(args[1])
                elif args[0] == "!pm":
                    if len(args) == 1:
                        return
                    return await self.whisper(args[1], " ".join(args[2:]))
                elif args[0] == "!tm":
                    if len(args) == 1:
                        return
                    return await self.sendTribeMessage(" ".join(args[1:]))
                elif args[0] == "!mort":
                    return await self._mort()
Beispiel #3
0
 def __init__(self, author, community, receiver, content, client):
     super().__init__(author, content, client)
     self.receiver = receiver
     self.community = ChatCommunity(community)
     self.sent = self.author == client.username
Beispiel #4
0
 def __init__(self, author, community, content, channel):
     super().__init__(author, content, channel._client)
     self.channel = channel
     self.community = ChatCommunity(community)