Beispiel #1
0
    def mute_user(self, event, target, length: list = None):
        """
        ***The Mute Command***

        This command restrict the target's message permissions either forever, or a certain amount of time if specified.

        ***Required Values***
        > __target__ **The user's full discord name, mention, or ID**

        **Optional Values**
        > __length__ **The amount of time until unmute in discord format.
        """
        target.add_role(self.config["MUTE_ROLE"])
        event.msg.add_reaction("👍")
        if length:
            seconds = sum(length)
            self.spawn_later(seconds, self.unmute, target)
            self.log_action(
                "Muted",
                "Muted {t.mention} for {s} seconds. Moderator: {e.author.mention}",
                target,
                s=seconds,
                e=event)
            Mute.create(target=target.id, end_time=int(time() + seconds))
        else:
            Mute.create(
                target=target.id, end_time=time() *
                2)  # This should ensure they never get unmuted, in theory?
Beispiel #2
0
 def execute_action(self, member, action):
     if "mute" in action:
         member.add_role(self.config["MUTE_ROLE"])
         self.spawn_later(action['mute'], self.unmute, member)
         Mute.create(target=member.id,
                     end_time=int(time() + action['mute']))