Skip to content

Commit

Permalink
Added shard count argument
Browse files Browse the repository at this point in the history
  • Loading branch information
DamourYouKnow committed May 14, 2019
1 parent a3ab73f commit a9e6c18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
class HahaNoUR(Bot):
def __init__(self, prefix: str, start_time: int, colour: int, logger,
session_manager: SessionManager, db: MongoClient,
error_log: int, feedback_log: int, shard_id: int):
error_log: int, feedback_log: int, shard_id: int,
shard_count: int):
"""
Init the instance of HahaNoUR.
:param prefix: the bot prefix.
Expand All @@ -28,7 +29,7 @@ def __init__(self, prefix: str, start_time: int, colour: int, logger,
:param db: the MongoDB data controller.
:param error_log: the channel id for error log.
"""
super().__init__(prefix, shard_id=shard_id)
super().__init__(prefix, shard_id=shard_id, shard_count=shard_count)
self.prefix = prefix
self.colour = colour
self.start_time = start_time
Expand Down
5 changes: 3 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@

def main():
shard = 0
if len(sys.argv) > 1:
if len(sys.argv) > 2:
shard = int(sys.argv[1])
shard_count = int(sys.argv[2])
print(shard)

start_time = int(time())
Expand All @@ -37,7 +38,7 @@ def main():
bot = HahaNoUR(
config['default_prefix'], start_time, int(config['colour'], base=16),
logger, session_manager, db, auth['error_log'], auth['feedback_log'],
shard_id = shard
shard, shard_count
)

bot.remove_command('help')
Expand Down

0 comments on commit a9e6c18

Please sign in to comment.