From 6b0dc5068959daa49c05b9d7cf28ea6c1ccdc745 Mon Sep 17 00:00:00 2001 From: io mintz Date: Tue, 16 Feb 2021 06:48:27 +0000 Subject: [PATCH] make sharding shit optional --- bot.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bot.py b/bot.py index 1def630..c026b09 100755 --- a/bot.py +++ b/bot.py @@ -60,14 +60,15 @@ class Bot(Bot): def main(): import sys - if len(sys.argv) < 3: - print('Usage:', sys.argv[0], ' ', file=sys.stderr) + if len(sys.argv) == 1: + shard_count = None + shard_ids = None + elif len(sys.argv) < 3: + print('Usage:', sys.argv[0], '[ ]', file=sys.stderr) sys.exit(1) - - # we place these lines up here instead of inline in order to improve tracebacks, - # as python tracebacks do not drill down to specific lines of a multi-line expression - shard_count = int(sys.argv[1]) - shard_ids = list(map(int, sys.argv[2].split('-'))) + else: + shard_count = int(sys.argv[1]) + shard_ids = list(map(int, sys.argv[2].split('-'))) Bot( intents=discord.Intents( @@ -79,6 +80,8 @@ def main(): emojis=True, # everything else, including `members` and `presences`, is implicitly false. ), + + # the least stateful bot you will ever see 😎 chunk_guilds_at_startup=False, member_cache_flags=discord.MemberCacheFlags.none(), # disable message cache