本文整理汇总了Python中pajbot.models.command.Command类的典型用法代码示例。如果您正苦于以下问题:Python Command类的具体用法?Python Command怎么用?Python Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Command类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_commands
def load_commands(self, **options):
self.commands['w'] = Command.raw_command(self.whisper,
level=2000,
description='Send a whisper from the bot')
self.commands['level'] = Command.raw_command(self.level,
level=1000,
description='Set a users level')
示例2: load_commands
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
def load_commands(self, **options):
self.commands[
self.settings["subon_command_name"].lower().replace("!", "").replace(" ", "")
] = Command.raw_command(self.paid_subon, cost=self.settings["subon_cost"])
self.commands[
self.settings["suboff_command_name"].lower().replace("!", "").replace(" ", "")
] = Command.raw_command(self.paid_suboff, cost=self.settings["suboff_cost"])
示例4: load_commands
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,
),
})
示例5: load_commands
def load_commands(self, **options):
self.commands['raffle'] = Command.raw_command(self.raffle,
delay_all=0,
delay_user=0,
level=500,
description='Start a raffle for points',
examples=[
CommandExample(None, 'Start a raffle for 69 points',
chat='user:!raffle 69\n'
'bot:A raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in in 60 seconds.',
description='Start a 60-second raffle for 69 points').parse(),
CommandExample(None, 'Start a raffle for the default value of {} points',
chat='user:!raffle 69 30\n'
'bot:A raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in in 30 seconds.',
description='Start a 30-second raffle for 69 points').parse(),
],
)
self.commands['join'] = Command.raw_command(self.join,
delay_all=0,
delay_user=5,
description='Join a running raffle',
examples=[
CommandExample(None, 'Join a running raffle',
chat='user:!join',
description='You don\'t get confirmation whether you joined the raffle or not.').parse(),
],
)
示例6: load_commands
def load_commands(self, **options):
self.commands['reload'] = Command.raw_command(self.reload,
level=1000,
description='Reload a bunch of data from the database')
self.commands['commit'] = Command.raw_command(self.commit,
level=1000,
description='Commit data from the bot to the database')
示例7: load_commands
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(),
]),
}
)
示例8: load_commands
def load_commands(self, **options):
self.commands['singleraffle'] = Command.raw_command(self.raffle,
delay_all=0,
delay_user=0,
level=500,
description='Start a raffle for points',
command='raffle',
examples=[
CommandExample(None, 'Start a raffle for 69 points',
chat='user:!raffle 69\n'
'bot:A raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in 60 seconds.',
description='Start a 60-second raffle for 69 points').parse(),
CommandExample(None, 'Start a raffle with a different length',
chat='user:!raffle 69 30\n'
'bot:A raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in 30 seconds.',
description='Start a 30-second raffle for 69 points').parse(),
],
)
self.commands['sraffle'] = self.commands['singleraffle']
self.commands['join'] = Command.raw_command(self.join,
delay_all=0,
delay_user=5,
description='Join a running raffle',
examples=[
CommandExample(None, 'Join a running raffle',
chat='user:!join',
description='You don\'t get confirmation whether you joined the raffle or not.').parse(),
],
)
if self.settings['multi_enabled']:
self.commands['multiraffle'] = Command.raw_command(self.multi_raffle,
delay_all=0,
delay_user=0,
level=500,
description='Start a multi-raffle for points',
command='multiraffle',
examples=[
CommandExample(None, 'Start a multi-raffle for 69 points',
chat='user:!multiraffle 69\n'
'bot:A multi-raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in 60 seconds.',
description='Start a 60-second raffle for 69 points').parse(),
CommandExample(None, 'Start a multi-raffle with a different length',
chat='user:!multiraffle 69 30\n'
'bot:A multi-raffle has begun for 69 points. Type !join to join the raffle! The raffle will end in 30 seconds.',
description='Start a 30-second multi-raffle for 69 points').parse(),
],
)
self.commands['mraffle'] = self.commands['multiraffle']
if self.settings['default_raffle_type'] == 'Multi Raffle' and self.settings['multi_enabled']:
self.commands['raffle'] = self.commands['multiraffle']
else:
self.commands['raffle'] = self.commands['singleraffle']
示例9: load_commands
def load_commands(self, **options):
# TODO: Have delay modifiable in settings
self.commands['followage'] = Command.raw_command(self.follow_age,
delay_all=4,
delay_user=8,
description='Check your or someone elses follow age for a channel',
examples=[
CommandExample(None, 'Check your own follow age',
chat='user:!followage\n'
'bot:pajlada, you have been following Karl_Kons for 4 months and 24 days',
description='Check how long you have been following the current streamer (Karl_Kons in this case)').parse(),
CommandExample(None, 'Check someone elses follow age',
chat='user:!followage NightNacht\n'
'bot:pajlada, NightNacht has been following Karl_Kons for 5 months and 4 days',
description='Check how long any user has been following the current streamer (Karl_Kons in this case)').parse(),
CommandExample(None, 'Check someones follow age for a certain streamer',
chat='user:!followage NightNacht forsenlol\n'
'bot:pajlada, NightNacht has been following forsenlol for 1 year and 4 months',
description='Check how long NightNacht has been following forsenlol').parse(),
CommandExample(None, 'Check your own follow age for a certain streamer',
chat='user:!followage pajlada forsenlol\n'
'bot:pajlada, you have been following forsenlol for 1 year and 3 months',
description='Check how long you have been following forsenlol').parse(),
],
)
self.commands['followsince'] = Command.raw_command(self.follow_since,
delay_all=4,
delay_user=8,
description='Check from when you or someone else first followed a channel',
examples=[
CommandExample(None, 'Check your own follow since',
chat='user:!followsince\n'
'bot:pajlada, you have been following Karl_Kons since 04 March 2015, 07:02:01 UTC',
description='Check when you first followed the current streamer (Karl_Kons in this case)').parse(),
CommandExample(None, 'Check someone elses follow since',
chat='user:!followsince NightNacht\n'
'bot:pajlada, NightNacht has been following Karl_Kons since 03 July 2014, 04:12:42 UTC',
description='Check when NightNacht first followed the current streamer (Karl_Kons in this case)').parse(),
CommandExample(None, 'Check someone elses follow since for another streamer',
chat='user:!followsince NightNacht forsenlol\n'
'bot:pajlada, NightNacht has been following forsenlol since 13 June 2013, 13:10:51 UTC',
description='Check when NightNacht first followed the given streamer (forsenlol)').parse(),
CommandExample(None, 'Check your follow since for another streamer',
chat='user:!followsince pajlada forsenlol\n'
'bot:pajlada, you have been following forsenlol since 16 December 1990, 03:06:51 UTC',
description='Check when you first followed the given streamer (forsenlol)').parse(),
],
)
示例10: load_commands
def load_commands(self, **options):
self.commands['pointlottery'] = Command.raw_command(
self.lottery,
delay_all=0,
delay_user=5,
description='Lottery for points',
examples=[
CommandExample(None,
'Lottery start',
chat='user:!pointlottery start\n'
'bot:A Lottery has begun. Type !pointlottery join {points} to join the lottery!',
description='Start lottery',
).parse(),
CommandExample(None,
'Lottery join',
chat='user:!pointlottery join {}',
description='You don\'t get confirmation whether you joined the lottery or not.',
).parse(),
CommandExample(None,
'Lottery stop',
chat='user:!pointlottery stop\n'
'bot:The lottery has finished! {} won {} points',
description='Finish lottery',
).parse(),
CommandExample(None,
'Lottery join',
chat='user:!pointlottery {}',
description='You don\'t get confirmation whether you joined the lottery or not.',
).parse(),
],
)
示例11: load_commands
def load_commands(self, **options):
# TODO: Aliases should be set in settings?
# This way, it can be run alongside other modules
self.commands['rank'] = Command.raw_command(self.league_rank,
delay_all=15,
delay_user=30,
description='Check streamer\'s or other players League of Legends rank in chat.',
examples=[
CommandExample(None, 'Check streamer\'s rank',
chat='user:!rank\n'
'bot: The Summoner Moregain Freeman on region EUW is currently in PLATINUM IV with 62 LP 4Head',
description='Bot says broadcaster\'s region, League-tier, division and LP').parse(),
CommandExample(None, 'Check other player\'s rank on default region',
chat='user:!rank forsen\n'
'bot: The Summoner forsen on region EUW is currently in SILVER IV with 36 LP 4Head',
description='Bot says player\'s region, League-tier, division and LP').parse(),
CommandExample(None, 'Check other player\'s rank on another region',
chat='user:!rank imaqtpie na\n'
'bot: The Summoner Imaqtpie on region NA is currently in CHALLENGER I with 441 LP 4Head',
description='Bot says player\'s region, League-tier, division and LP. Other regions to use as arguments: euw, eune, na, oce, br, kr, las, lan, ru, tr').parse(),
],
)
self.commands['lolrank'] = self.commands['rank']
self.commands['ranklol'] = self.commands['rank']
self.commands['leaguerank'] = self.commands['rank']
示例12: load_commands
def load_commands(self, **options):
self.commands['#showemote'] = Command.raw_command(
self.show_emote,
tokens_cost=1,
description='Show an emote on stream! Costs 1 token.',
can_execute_with_whisper=True,
)
示例13: load_commands
def load_commands(self, **options):
self.commands["math"] = Command.raw_command(
self.math,
delay_all=self.settings["online_global_cd"],
delay_user=self.settings["online_user_cd"],
description="Calculate some simple math",
examples=[],
)
示例14: load_commands
def load_commands(self, **options):
self.command_name = self.settings['command_name'].lower().replace('!', '').replace(' ', '')
self.commands[self.command_name] = Command.raw_command(
self.give_points,
sub_only=self.settings['source_requires_sub'],
delay_all=0,
delay_user=0,
can_execute_with_whisper=True,
)
示例15: load_commands
def load_commands(self, **options):
# TODO: Have delay modifiable in settings
self.commands['math'] = Command.raw_command(self.math,
delay_all=2,
delay_user=6,
description='Calculate some simple math',
examples=[
],
)