make sharding shit optional

This commit is contained in:
io mintz 2021-02-16 06:48:27 +00:00
parent 60f81b5a72
commit 6b0dc50689
1 changed files with 10 additions and 7 deletions

13
bot.py
View File

@ -60,12 +60,13 @@ class Bot(Bot):
def main(): def main():
import sys import sys
if len(sys.argv) < 3: if len(sys.argv) == 1:
print('Usage:', sys.argv[0], '<shard count> <hyphen-separated list of shard IDs>', file=sys.stderr) shard_count = None
shard_ids = None
elif len(sys.argv) < 3:
print('Usage:', sys.argv[0], '[<shard count> <hyphen-separated list of shard IDs>]', file=sys.stderr)
sys.exit(1) sys.exit(1)
else:
# 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_count = int(sys.argv[1])
shard_ids = list(map(int, sys.argv[2].split('-'))) shard_ids = list(map(int, sys.argv[2].split('-')))
@ -79,6 +80,8 @@ def main():
emojis=True, emojis=True,
# everything else, including `members` and `presences`, is implicitly false. # everything else, including `members` and `presences`, is implicitly false.
), ),
# the least stateful bot you will ever see 😎
chunk_guilds_at_startup=False, chunk_guilds_at_startup=False,
member_cache_flags=discord.MemberCacheFlags.none(), member_cache_flags=discord.MemberCacheFlags.none(),
# disable message cache # disable message cache