本文整理汇总了Python中pajbot.models.command.Command.multiaction_command方法的典型用法代码示例。如果您正苦于以下问题:Python Command.multiaction_command方法的具体用法?Python Command.multiaction_command怎么用?Python Command.multiaction_command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pajbot.models.command.Command
的用法示例。
在下文中一共展示了Command.multiaction_command方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
self.commands['add'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='add',
commands={
'banphrase': Command.raw_command(self.add_banphrase,
level=500,
description='Add a banphrase!',
examples=[
CommandExample(None, 'Create a banphrase',
chat='user:!add banphrase testman123\n'
'bot>user:Inserted your banphrase (ID: 83)',
description='This creates a banphrase with the default settings. Whenever a non-moderator types testman123 in chat they will be timed out for 300 seconds and notified through a whisper that they said something they shouldn\'t have said').parse(),
CommandExample(None, 'Create a banphrase that permabans people',
chat='user:!add banphrase testman123 --perma\n'
'bot>user:Inserted your banphrase (ID: 83)',
description='This creates a banphrase that permabans the user who types testman123 in chat. The user will be notified through a whisper that they said something they shouldn\'t have said').parse(),
CommandExample(None, 'Create a banphrase that permabans people without a notification',
chat='user:!add banphrase testman123 --perma --no-notify\n'
'bot>user:Inserted your banphrase (ID: 83)',
description='This creates a banphrase that permabans the user who types testman123 in chat').parse(),
CommandExample(None, 'Change the default timeout length for a banphrase',
chat='user:!add banphrase testman123 --time 123\n'
'bot>user:Updated the given banphrase (ID: 83) with (time, extra_args)',
description='Changes the default timeout length to a custom time of 123 seconds').parse(),
CommandExample(None, 'Make it so a banphrase cannot be triggered by subs',
chat='user:!add banphrase testman123 --subimmunity\n'
'bot>user:Updated the given banphrase (ID: 83) with (sub_immunity)',
description='Changes a command so that the banphrase can only be triggered by people who are not subscribed to the channel.').parse(),
]),
}
)
self.commands['remove'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='remove',
commands={
'banphrase': Command.raw_command(self.remove_banphrase,
level=500,
description='Remove a banphrase!',
examples=[
CommandExample(None, 'Remove a banphrase',
chat='user:!remove banphrase KeepoKeepo\n'
'bot>user:Successfully removed banphrase with id 33',
description='Removes a banphrase with the trigger KeepoKeepo.').parse(),
CommandExample(None, 'Remove a banphrase with the given ID.',
chat='user:!remove banphrase 25\n'
'bot>user:Successfully removed banphrase with id 25',
description='Removes a banphrase with id 25').parse(),
]),
}
)
示例2: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
get_cmd = Command.raw_command(self.get_bttv_emotes,
level=100,
delay_all=3,
delay_user=6,
examples=[
CommandExample(None, 'Show all active bttv emotes for this channel.',
chat='user: !bttvemotes\n'
'bot: Active BTTV Emotes in chat: forsenPls gachiGASM',
description='').parse(),
])
reload_cmd = Command.raw_command(self.reload_bttv_emotes,
level=500,
delay_all=10,
delay_user=20,
examples=[
CommandExample(None, 'Reload all active bttv emotes for this channel.',
chat='user: !bttvemotes reload\n'
'bot>user: Reloading bttv emotes...',
description='').parse(),
])
# The ' ' is there to make things look good in the
# web interface.
self.commands['bttvemotes'] = Command.multiaction_command(
level=100,
default=' ',
fallback=' ',
command='bttvemotes',
commands={
'reload': reload_cmd,
' ': get_cmd,
}
)
示例3: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
self.commands['hsbet'] = Command.multiaction_command(
level=100,
default='bet',
fallback='bet',
delay_all=0,
delay_user=0,
can_execute_with_whisper=True,
commands={
'bet': Command.raw_command(
self.command_bet,
delay_all=0,
delay_user=10,
can_execute_with_whisper=True,
),
'open': Command.raw_command(
self.command_open,
level=500,
delay_all=0,
delay_user=0,
can_execute_with_whisper=True,
),
'close': Command.raw_command(
self.command_close,
level=500,
delay_all=0,
delay_user=0,
can_execute_with_whisper=True,
),
})
示例4: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
self.commands['trivia'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
can_execute_with_whisper=True,
commands={
'start': Command.raw_command(
self.command_start,
level=500,
delay_all=0,
delay_user=10,
can_execute_with_whisper=True,
),
'stop': Command.raw_command(
self.command_stop,
level=500,
delay_all=0,
delay_user=0,
can_execute_with_whisper=True,
),
}
)
示例5: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
self.commands['debug'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
commands={
'command': Command.raw_command(self.debug_command,
level=250,
description='Debug a command',
examples=[
CommandExample(None, 'Debug a command',
chat='user:!debug command ping\n'
'bot>user: id=210, level=100, type=message, cost=0, cd_all=10, cd_user=30, mod_only=False, response=Snusbot has been online for $(tb:bot_uptime)',
description='').parse(),
]),
'user': Command.raw_command(self.debug_user,
level=250,
description='Debug a user',
examples=[
CommandExample(None, 'Debug a user',
chat='user:!debug user snusbot\n'
'bot>user: id=123, level=100, num_lines=45, points=225, last_seen=2016-04-05 17:56:23 CEST, last_active=2016-04-05 17:56:07 CEST, ignored=False, banned=False, tokens=0',
description='').parse(),
]),
'tags': Command.raw_command(self.debug_tags,
level=100,
delay_all=0,
delay_user=5,
description='Debug tags for a user',
examples=[
CommandExample(None, 'Debug tags for a user',
chat='user:!debug tags pajbot\n'
'bot>user: pajbot have the following tags: pajlada_sub until 2016-04-28',
description='').parse(),
])
})
示例6: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
self.commands['setdeck'] = Command.raw_command(self.set_deck,
level=420,
delay_all=0,
delay_user=0,
description='Sets the deck that is currently playing.',
examples=[
CommandExample(None, 'Add a new deck',
chat='user:!set deck http://i.imgur.com/rInqJv0.png\n'
'bot>user:This deck is a new deck. Its ID is 32',
description='This is the output if you set a deck which hasn\'t been set before.').parse(),
CommandExample(None, 'Set a pre-existing deck',
chat='user:!set deck http://i.imgur.com/rInqJv0.png\n'
'bot>user:Updated an already-existing deck. Its ID is 32',
description='This is the output if you set a deck which was added previously.').parse(),
])
self.commands['set'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='set',
commands={
'deck': self.commands['setdeck']
})
self.commands['update'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='update',
commands={
'deck': Command.raw_command(self.update_deck,
level=420,
description='Updates an already-existing deck.',
examples=[
CommandExample(None, 'Set the name and class of the current deck',
chat='user:!update deck --name Midrange Secret --class paladin\n'
'bot>user:Updated deck with ID 32. Updated name, class').parse(),
CommandExample(None, 'Updates the link of the current deck',
chat='user:!update deck --link http://i.imgur.com/QEVwrVV.png\n'
'bot>user:Updated deck with ID 32. Updated link',
description='Changes the link of the current deck. This could be used if you want to reupload the screenshot to imgur or something.').parse(),
CommandExample(None, 'Set the name and class of an old deck',
chat='user:!update deck --id 12 --name Aggro --class hunter\n'
'bot>user:Updated deck with ID 12. Updated name, class',
description='Updates the name and class of an old deck. Useful for whenever you need to clean up old decks.').parse(),
]),
})
self.commands['remove'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='remove',
commands={
'deck': Command.raw_command(self.remove_deck,
level=420,
description='Removes a deck with the given ID.',
examples=[
CommandExample(None, 'Remove a deck by ID',
chat='user:!remove deck 123\n'
'bot>user:Successfully removed the deck.',
description='The ID in this case is 123').parse(),
CommandExample(None, 'Remove a deck by URL',
chat='user:!remove deck http://i.imgur.com/rInqJv0.png\n'
'bot>user:Successfully removed the deck.',
description='The URL in this case is http://i.imgur.com/rInqJv0.png').parse(),
]),
})
示例7: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
self.commands['add'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='add',
commands={
'link': Command.multiaction_command(
level=500,
delay_all=0,
delay_user=0,
default=None,
commands={
'blacklist': Command.raw_command(self.add_link_blacklist,
level=500,
description='Blacklist a link',
examples=[
CommandExample(None, 'Add a link to the blacklist for shallow search',
chat='user:!add link blacklist 0 scamlink.lonk/\n'
'bot>user:Successfully added your links',
description='Added the link scamlink.lonk/ to the blacklist for a shallow search').parse(),
CommandExample(None, 'Add a link to the blacklist for deep search',
chat='user:!add link blacklist 1 scamlink.lonk/\n'
'bot>user:Successfully added your links',
description='Added the link scamlink.lonk/ to the blacklist for a deep search').parse(),
]),
'whitelist': Command.raw_command(self.add_link_whitelist,
level=500,
description='Whitelist a link',
examples=[
CommandExample(None, 'Add a link to the whitelist',
chat='user:!add link whitelink safelink.lonk/\n'
'bot>user:Successfully added your links',
description='Added the link safelink.lonk/ to the whitelist').parse(),
]),
}
)
}
)
self.commands['remove'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='remove',
commands={
'link': Command.multiaction_command(
level=500,
delay_all=0,
delay_user=0,
default=None,
commands={
'blacklist': Command.raw_command(self.remove_link_blacklist,
level=500,
description='Unblacklist a link',
examples=[
CommandExample(None, 'Remove a blacklist link',
chat='user:!remove link blacklist scamtwitch.scam\n'
'bot>user:Successfully removed your links',
description='Removes scamtwitch.scam as a blacklisted link').parse(),
]),
'whitelist': Command.raw_command(self.remove_link_whitelist,
level=500,
description='Unwhitelist a link',
examples=[
CommandExample(None, 'Remove a whitelist link',
chat='user:!remove link whitelist twitch.safe\n'
'bot>user:Successfully removed your links',
description='Removes twitch.safe as a whitelisted link').parse(),
]),
}
),
}
)
示例8: load_internal_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_internal_commands(self, **options):
if len(self.internal_commands) > 0:
return self.internal_commands
self.internal_commands = {}
self.internal_commands['quit'] = Command.pajbot_command(self.bot, 'quit',
level=1000,
command='quit',
description='Shut down the bot, this will most definitely restart it if set up properly')
self.internal_commands['1quit'] = self.internal_commands['quit']
self.internal_commands['ceaseallactionscurrentlybeingacteduponwiththecodeandiapologizeforbeingawhitecisgenderedmaleinthepatriarchy'] = self.internal_commands['quit']
self.internal_commands['twitterfollow'] = Command.dispatch_command('twitter_follow',
level=1000,
description='Start listening for tweets for the given user',
examples=[
CommandExample(None, 'Default usage',
chat='user:!twitterfollow forsensc2\n'
'bot>user:Now following ForsenSC2',
description='Follow ForsenSC2 on twitter so new tweets are output in chat.').parse(),
])
self.internal_commands['twitterunfollow'] = Command.dispatch_command('twitter_unfollow',
level=1000,
description='Stop listening for tweets for the given user',
examples=[
CommandExample(None, 'Default usage',
chat='user:!twitterunfollow forsensc2\n'
'bot>user:No longer following ForsenSC2',
description='Stop automatically printing tweets from ForsenSC2').parse(),
])
self.internal_commands['add'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='add',
commands={
'command': Command.dispatch_command('add_command',
level=500,
description='Add a command!',
examples=[
CommandExample(None, 'Create a normal command',
chat='user:!add command test Kappa 123\n'
'bot>user:Added your command (ID: 7)',
description='This creates a normal command with the trigger !test which outputs Kappa 123 to chat').parse(),
CommandExample(None, 'Create a command that responds with a whisper',
chat='user:!add command test Kappa 123 --whisper\n'
'bot>user:Added your command (ID: 7)',
description='This creates a command with the trigger !test which responds with Kappa 123 as a whisper to the user who called the command').parse(),
]),
'win': Command.dispatch_command('add_win',
level=500,
description='Add a win to something!'),
'funccommand': Command.dispatch_command('add_funccommand',
level=2000,
description='Add a command that uses a command'),
'alias': Command.dispatch_command('add_alias',
level=500,
description='Adds an alias to an already existing command',
examples=[
CommandExample(None, 'Add an alias to a command',
chat='user:!add alias test alsotest\n'
'bot>user:Successfully added the aliases alsotest to test',
description='Adds the alias !alsotest to the existing command !test').parse(),
CommandExample(None, 'Add multiple aliases to a command',
chat='user:!add alias test alsotest newtest test123\n'
'bot>user:Successfully added the aliases alsotest, newtest, test123 to test',
description='Adds the aliases !alsotest, !newtest, and !test123 to the existing command !test').parse(),
]),
})
self.internal_commands['edit'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='edit',
commands={
'command': Command.dispatch_command('edit_command',
level=500,
description='Edit an already-existing command',
examples=[
CommandExample(None, 'Change the response',
chat='user:!edit command test This is the new response!\n'
'bot>user:Updated the command (ID: 29)',
description='Changes the text response for the command !test to "This is the new response!"').parse(),
CommandExample(None, 'Change the Global Cooldown',
chat='user:!edit command test --cd 10\n'
'bot>user:Updated the command (ID: 29)',
description='Changes the global cooldown for the command !test to 10 seconds').parse(),
CommandExample(None, 'Change the User-specific Cooldown',
chat='user:!edit command test --usercd 30\n'
'bot>user:Updated the command (ID: 29)',
description='Changes the user-specific cooldown for the command !test to 30 seconds').parse(),
CommandExample(None, 'Change the Level for a command',
chat='user:!edit command test --level 500\n'
#.........这里部分代码省略.........
示例9: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
self.commands['bingo'] = Command.multiaction_command(
level=500,
default=None,
command='bingo',
commands={
'emotes': Command.raw_command(self.bingo_emotes,
level=500,
delay_all=15,
delay_user=15,
description='Start an emote bingo with BTTV and TWITCH global emotes',
examples=[
CommandExample(None, 'Emote bingo for 100 points',
chat='user:!bingo emotes\n'
'bot: A bingo has started! Guess the right target to win 100 points! Only one target per message! ',
description='').parse(),
CommandExample(None, 'Emote bingo for 222 points',
chat='user:!bingo emotes 222\n'
'bot: A bingo has started! Guess the right target to win 222 points! Only one target per message! ',
description='').parse(),
]),
'bttv': Command.raw_command(self.bingo_bttv,
level=500,
delay_all=15,
delay_user=15,
description='Start an emote bingo with BTTV global emotes',
examples=[
CommandExample(None, 'Emote bingo for 100 points',
chat='user:!bingo bttv\n'
'bot: A bingo has started! Guess the right target to win 100 points! Only one target per message! Use BTTV global emotes. ',
description='').parse(),
CommandExample(None, 'Emote bingo for 222 points',
chat='user:!bingo bttv 222\n'
'bot: A bingo has started! Guess the right target to win 222 points! Only one target per message! Use BTTV global emotes. ',
description='').parse(),
]),
'twitch': Command.raw_command(self.bingo_twitch,
level=500,
delay_all=15,
delay_user=15,
description='Start an emote bingo with TWITCH global emotes',
examples=[
CommandExample(None, 'Emote bingo for 100 points',
chat='user:!bingo twitch\n'
'bot: A bingo has started! Guess the right target to win 100 points! Only one target per message! Use TWITCH global emotes. ',
description='').parse(),
CommandExample(None, 'Emote bingo for 222 points',
chat='user:!bingo twitch 222\n'
'bot: A bingo has started! Guess the right target to win 222 points! Only one target per message! Use TWITCH global emotes. ',
description='').parse(),
]),
'cancel': Command.raw_command(self.bingo_cancel,
level=500,
delay_all=15,
delay_user=15,
description='Cancel a running bingo',
examples=[
CommandExample(None, 'Cancel a bingo',
chat='user:!bingo cancel\n'
'bot: Bingo cancelled by pajlada FeelsBadMan',
description='').parse(),
]),
'help': Command.raw_command(self.bingo_help_random,
level=500,
delay_all=15,
delay_user=15,
description='The bot will help the chat with a random letter from the bingo target',
examples=[
CommandExample(None, 'Get a random letter from the bingo target',
chat='user:!bingo help\n'
'bot: A bingo for 100 points is still running. You should maybe use a a a a a for the target',
description='').parse(),
]),
'cheat': Command.raw_command(self.bingo_help_first,
level=500,
delay_all=15,
delay_user=15,
description='The bot will help the chat with the first letter from the bingo target',
examples=[
CommandExample(None, 'Get the first letter from the bingo target',
chat='user:!bingo cheat\n'
'bot: A bingo for 100 points is still running. You should use W W W W W as the first letter for the target',
description='').parse(),
]),
})
示例10: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
self.commands["predict"] = Command.multiaction_command(
level=100,
default="vote",
fallback="vote",
delay_all=0,
delay_user=0,
commands={
"vote": Command.raw_command(
self.predict,
delay_all=0,
delay_user=10,
sub_only=self.settings["sub_only"],
can_execute_with_whisper=True,
description="Predict how many wins will occur in the "
+ self.settings["challenge_name"]
+ " challenge",
),
"new": Command.raw_command(
self.new_predict,
delay_all=10,
delay_user=10,
description="Starts a new " + self.settings["challenge_name"] + " run",
level=750,
),
"end": Command.raw_command(
self.end_predict,
delay_all=10,
delay_user=10,
description="Ends a " + self.settings["challenge_name"] + " run",
level=750,
),
"close": Command.raw_command(
self.close_predict,
delay_all=10,
delay_user=10,
description="Close submissions to the latest " + self.settings["challenge_name"] + " run",
level=750,
),
},
)
# XXX: DEPRECATED, WILL BE REMOVED
self.commands["newpredict"] = Command.raw_command(
self.new_predict_depr,
delay_all=10,
delay_user=10,
description="Starts a new " + self.settings["challenge_name"] + " run",
level=750,
)
self.commands["endpredict"] = Command.raw_command(
self.end_predict_depr,
delay_all=10,
delay_user=10,
description="Ends a " + self.settings["challenge_name"] + " run",
level=750,
)
self.commands["closepredict"] = Command.raw_command(
self.close_predict_depr,
delay_all=10,
delay_user=10,
description="Close submissions to the latest " + self.settings["challenge_name"] + " run",
level=750,
)
mini_command = self.settings["mini_command"].lower().replace("!", "").replace(" ", "")
if len(mini_command) > 0:
self.commands[mini_command] = Command.multiaction_command(
level=100,
default="vote",
fallback="vote",
delay_all=0,
delay_user=0,
commands={
"vote": Command.raw_command(
self.mini_predict,
delay_all=0,
delay_user=10,
sub_only=self.settings["sub_only"],
can_execute_with_whisper=True,
description="Predict how many wins will occur in the "
+ self.settings["challenge_name"]
+ " challenge",
),
"new": Command.raw_command(
self.mini_new_predict,
delay_all=10,
delay_user=10,
description="Starts a new " + self.settings["challenge_name"] + " run",
level=750,
),
"end": Command.raw_command(
self.mini_end_predict,
delay_all=10,
delay_user=10,
description="Ends a " + self.settings["challenge_name"] + " run",
level=750,
),
"close": Command.raw_command(
self.mini_close_predict,
#.........这里部分代码省略.........
示例11: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
self.commands['predict'] = Command.multiaction_command(
level=100,
default='vote',
fallback='vote',
delay_all=0,
delay_user=0,
commands={
'vote': Command.raw_command(self.predict,
delay_all=0,
delay_user=10,
sub_only=self.settings['sub_only'],
can_execute_with_whisper=True,
description='Predict how many wins will occur in the ' + self.settings['challenge_name'] + ' challenge'),
'new': Command.raw_command(self.new_predict,
delay_all=10,
delay_user=10,
description='Starts a new ' + self.settings['challenge_name'] + ' run',
level=750),
'end': Command.raw_command(self.end_predict,
delay_all=10,
delay_user=10,
description='Ends a ' + self.settings['challenge_name'] + ' run',
level=750),
'close': Command.raw_command(self.close_predict,
delay_all=10,
delay_user=10,
description='Close submissions to the latest ' + self.settings['challenge_name'] + ' run',
level=750),
}
)
# XXX: DEPRECATED, WILL BE REMOVED
self.commands['newpredict'] = Command.raw_command(self.new_predict_depr,
delay_all=10,
delay_user=10,
description='Starts a new ' + self.settings['challenge_name'] + ' run',
level=750)
self.commands['endpredict'] = Command.raw_command(self.end_predict_depr,
delay_all=10,
delay_user=10,
description='Ends a ' + self.settings['challenge_name'] + ' run',
level=750)
self.commands['closepredict'] = Command.raw_command(self.close_predict_depr,
delay_all=10,
delay_user=10,
description='Close submissions to the latest ' + self.settings['challenge_name'] + ' run',
level=750)
mini_command = self.settings['mini_command'].lower().replace('!', '').replace(' ', '')
if len(mini_command) > 0:
self.commands[mini_command] = Command.multiaction_command(
level=100,
default='vote',
fallback='vote',
delay_all=0,
delay_user=0,
commands={
'vote': Command.raw_command(self.mini_predict,
delay_all=0,
delay_user=10,
sub_only=self.settings['sub_only'],
can_execute_with_whisper=True,
description='Predict how many wins will occur in the ' + self.settings['challenge_name'] + ' challenge'),
'new': Command.raw_command(self.mini_new_predict,
delay_all=10,
delay_user=10,
description='Starts a new ' + self.settings['challenge_name'] + ' run',
level=750),
'end': Command.raw_command(self.mini_end_predict,
delay_all=10,
delay_user=10,
description='Ends a ' + self.settings['challenge_name'] + ' run',
level=750),
'close': Command.raw_command(self.mini_close_predict,
delay_all=10,
delay_user=10,
description='Close submissions to the latest ' + self.settings['challenge_name'] + ' run',
level=750),
}
)
示例12: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
commands = {
'link': Command.raw_command(
self.link,
level=100,
delay_all=self.settings['global_cd'],
delay_user=self.settings['user_cd'],
description='Get link to your dubtrack',
examples=[
CommandExample(
None,
'Ask bot for dubtrack link',
chat='user:!dubtrack link\n'
'bot:Request your songs at https://dubtrack.fm/join/pajlada').parse(),
],
),
'song': Command.raw_command(
self.song,
level=100,
delay_all=self.settings['global_cd'],
delay_user=self.settings['user_cd'],
description='Get current song',
run_in_thread=True,
examples=[
CommandExample(
None,
'Ask bot for current song (youtube)',
chat='user:!dubtrack song\n'
'bot:Current song: NOMA - Brain Power, link: https://youtu.be/9R8aSKwTEMg').parse(),
CommandExample(
None,
'Ask bot for current song (soundcloud)',
chat='user:!dubtrack song\n'
'bot:Current song: This is Bondage, link: https://soundcloud.com/razq35/nightlife').parse(),
CommandExample(
None,
'Ask bot for current song (nothing playing)',
chat='user:!dubtrack song\n'
'bot:There\'s no song playing right now FeelsBadMan').parse(),
],
),
'update': Command.raw_command(
self.update,
level=500,
delay_all=self.settings['global_cd'],
delay_user=self.settings['user_cd'],
description='Force reloading the song and get current song',
run_in_thread=True,
),
}
if self.settings['if_short_alias']:
commands['l'] = commands['link']
commands['s'] = commands['song']
commands['u'] = commands['update']
self.commands['dubtrack'] = Command.multiaction_command(
level=100,
default='link', # If the user does not input any argument
fallback='link', # If the user inputs an invalid argument
command='dubtrack',
commands=commands,
)
if self.settings['if_dt_alias']:
self.commands['dt'] = self.commands['dubtrack']
if self.settings['if_song_alias']:
self.commands['song'] = commands['song']
示例13: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
try:
level_trusted_mods = 100 if self.bot.trusted_mods else 500
mod_only_trusted_mods = True if self.bot.trusted_mods else False
except AttributeError:
level_trusted_mods = 500
mod_only_trusted_mods = False
if self.settings['allow_subs']:
add_highlight_level = 100
mod_only_trusted_mods = False
else:
add_highlight_level = level_trusted_mods
self.commands['add'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='add',
commands={
'highlight': Command.raw_command(self.add_highlight,
level=add_highlight_level,
delay_all=30 if self.settings['allow_subs'] else 0,
delay_user=60 if self.settings['allow_subs'] else 4,
mod_only=mod_only_trusted_mods,
sub_only=self.settings['allow_subs'],
description='Creates a highlight at the current timestamp',
examples=[
CommandExample(None, 'Create a highlight',
chat='user:!add highlight 1v5 Pentakill\n'
'bot>user:Successfully created your highlight',
description='Creates a highlight with the description 1v5 Pentakill').parse(),
CommandExample(None, 'Create a highlight with a different offset',
chat='user:!add highlight 1v5 Pentakill --offset 60\n'
'bot>user:Successfully created your highlight',
description='Creates a highlight with the description 1v5 Pentakill and an offset of 60 seconds.').parse(),
]),
}
)
self.commands['edit'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='edit',
commands={
'highlight': Command.raw_command(self.edit_highlight,
level=level_trusted_mods,
mod_only=mod_only_trusted_mods,
description='Edit the highlight with the given ID',
examples=[
CommandExample(None, 'Change the offset with the given ID.',
chat='user:!edit highlight --offset 180 --id 12\n'
'bot>user:Successfully updated your highlight (offset)',
description='Changes the offset to 180 seconds for the highlight ID 12').parse(),
CommandExample(None, 'Change the description with the given ID.',
chat='user:!edit highlight 1v5 Pentakill PogChamp VAC --id 12\n'
'bot>user:Successfully updated your highlight (description)',
description='Changes the description to \'1v5 Pentakill PogChamp VAC\' for highlight ID 12.').parse(),
CommandExample(None, 'Change the VOD link to a mirror link.',
chat='user:!edit highlight --id 12 --link http://www.twitch.tv/imaqtpie/v/27878606\n' # TODO turn off autolink
'bot>user:Successfully updated your highlight (override_link)',
description='Changes the link for highlight ID 12 to http://www.twitch.tv/imaqtpie/v/27878606').parse(),
CommandExample(None, 'Change the mirror link back to the VOD link.',
chat='user:!edit highlight --id 12 --no-link\n'
'bot>user:Successfully updated your highlight (override_link)',
description='Changes the link for highlight ID 12 back to the twitch VOD link.').parse(),
]),
}
)
self.commands['remove'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='remove',
commands={
'highlight': Command.raw_command(self.remove_highlight,
level=level_trusted_mods,
mod_only=mod_only_trusted_mods,
description='Removes a highlight with the given ID.',
examples=[
CommandExample(None, 'Remove a highlight',
chat='user:!remove highlight 2\n'
'bot>user:Successfully removed highlight with ID 2.',
description='Removes the highlight ID 2').parse(),
]),
}
)
示例14: load_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_commands(self, **options):
self.commands['add'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='add',
commands={
'link': Command.multiaction_command(
level=500,
delay_all=0,
delay_user=0,
default=None,
commands={
'blacklist': Command.raw_command(self.add_link_blacklist,
level=500,
delay_all=0,
delay_user=0,
description='Blacklist a link',
examples=[
CommandExample(None, 'Add a link to the blacklist for a shallow search',
chat='user:!add link blacklist --shallow scamlink.lonk/\n'
'bot>user:Successfully added your links',
description='Added the link scamlink.lonk/ to the blacklist for a shallow search').parse(),
CommandExample(None, 'Add a link to the blacklist for a deep search',
chat='user:!add link blacklist --deep scamlink.lonk/\n'
'bot>user:Successfully added your links',
description='Added the link scamlink.lonk/ to the blacklist for a deep search').parse(),
]),
'whitelist': Command.raw_command(self.add_link_whitelist,
level=500,
delay_all=0,
delay_user=0,
description='Whitelist a link',
examples=[
CommandExample(None, 'Add a link to the whitelist',
chat='user:!add link whitelink safelink.lonk/\n'
'bot>user:Successfully added your links',
description='Added the link safelink.lonk/ to the whitelist').parse(),
]),
}
)
}
)
self.commands['remove'] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command='remove',
commands={
'link': Command.multiaction_command(
level=500,
delay_all=0,
delay_user=0,
default=None,
commands={
'blacklist': Command.raw_command(self.remove_link_blacklist,
level=500,
delay_all=0,
delay_user=0,
description='Remove a link from the blacklist.',
examples=[
CommandExample(None, 'Remove a link from the blacklist.',
chat='user:!remove link blacklist 20\n'
'bot>user:Successfully removed blacklisted link with id 20',
description='Remove a link from the blacklist with an ID').parse(),
]),
'whitelist': Command.raw_command(self.remove_link_whitelist,
level=500,
delay_all=0,
delay_user=0,
description='Remove a link from the whitelist.',
examples=[
CommandExample(None, 'Remove a link from the whitelist.',
chat='user:!remove link whitelist 12\n'
'bot>user:Successfully removed blacklisted link with id 12',
description='Remove a link from the whitelist with an ID').parse(),
]),
}
),
}
)
示例15: load_internal_commands
# 需要导入模块: from pajbot.models.command import Command [as 别名]
# 或者: from pajbot.models.command.Command import multiaction_command [as 别名]
def load_internal_commands(self, **options):
if len(self.internal_commands) > 0:
return self.internal_commands
self.internal_commands = {}
self.internal_commands["quit"] = Command.pajbot_command(
self.bot,
"quit",
level=1000,
command="quit",
description="Shut down the bot, this will most definitely restart it if set up properly",
)
self.internal_commands[
"ceaseallactionscurrentlybeingacteduponwiththecodeandiapologizeforbeingawhitecisgenderedmaleinthepatriarchy"
] = self.internal_commands["quit"]
self.internal_commands["twitterfollow"] = Command.dispatch_command(
"twitter_follow",
level=1000,
description="Start listening for tweets for the given user",
examples=[
CommandExample(
None,
"Default usage",
chat="user:!twitterfollow forsensc2\n" "bot>user:Now following ForsenSC2",
description="Follow ForsenSC2 on twitter so new tweets are output in chat.",
).parse()
],
)
self.internal_commands["twitterunfollow"] = Command.dispatch_command(
"twitter_unfollow",
level=1000,
description="Stop listening for tweets for the given user",
examples=[
CommandExample(
None,
"Default usage",
chat="user:!twitterunfollow forsensc2\n" "bot>user:No longer following ForsenSC2",
description="Stop automatically printing tweets from ForsenSC2",
).parse()
],
)
self.internal_commands["add"] = Command.multiaction_command(
level=100,
delay_all=0,
delay_user=0,
default=None,
command="add",
commands={
"command": Command.dispatch_command(
"add_command",
level=500,
description="Add a command!",
examples=[
CommandExample(
None,
"Create a normal command",
chat="user:!add command test Kappa 123\n" "bot>user:Added your command (ID: 7)",
description="This creates a normal command with the trigger !test which outputs Kappa 123 to chat",
).parse(),
CommandExample(
None,
"Create a command that responds with a whisper",
chat="user:!add command test Kappa 123 --whisper\n" "bot>user:Added your command (ID: 7)",
description="This creates a command with the trigger !test which responds with Kappa 123 as a whisper to the user who called the command",
).parse(),
],
),
"win": Command.dispatch_command("add_win", level=500, description="Add a win to something!"),
"funccommand": Command.dispatch_command(
"add_funccommand", level=2000, description="Add a command that uses a command"
),
"alias": Command.dispatch_command(
"add_alias",
level=500,
description="Adds an alias to an already existing command",
examples=[
CommandExample(
None,
"Add an alias to a command",
chat="user:!add alias test alsotest\n"
"bot>user:Successfully added the aliases alsotest to test",
description="Adds the alias !alsotest to the existing command !test",
).parse(),
CommandExample(
None,
"Add multiple aliases to a command",
chat="user:!add alias test alsotest newtest test123\n"
"bot>user:Successfully added the aliases alsotest, newtest, test123 to test",
description="Adds the aliases !alsotest, !newtest, and !test123 to the existing command !test",
).parse(),
],
),
},
)
self.internal_commands["edit"] = Command.multiaction_command(
#.........这里部分代码省略.........