Skip to content

Commit

Permalink
Only parse intents if they are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
iHeroGH authored and 4Kaylum committed Sep 25, 2023
1 parent d5832ef commit c6e7d3a
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions novus/ext/client/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,23 @@ def check(name: str) -> bool:
if check("shard_count"):
self.shard_count = int(args.shard_count)

if check("intents") and args.intents == "*":
self.intents = novus.Intents.all()
intent_kwargs = {}
for i in (args.intents or "").split(","):
if i and i != "*":
intent_kwargs[i.strip().lower().replace("-", "_")] = True
for i in args.intent or []:
if i:
intent_kwargs[i.strip().lower().replace("-", "_")] = True
for i in (args.no_intents or "").split(","):
if i:
intent_kwargs[i.strip().lower().replace("-", "_")] = False
for i in args.no_intent or []:
if i:
intent_kwargs[i.strip().lower().replace("-", "_")] = False
self.intents.update(**intent_kwargs)
if check("intents"):
if args.intents == "*":
self.intents = novus.Intents.all()
intent_kwargs = {}
for i in (args.intents or "").split(","):
if i and i != "*":
intent_kwargs[i.strip().lower().replace("-", "_")] = True
for i in args.intent or []:
if i:
intent_kwargs[i.strip().lower().replace("-", "_")] = True
for i in (args.no_intents or "").split(","):
if i:
intent_kwargs[i.strip().lower().replace("-", "_")] = False
for i in args.no_intent or []:
if i:
intent_kwargs[i.strip().lower().replace("-", "_")] = False
self.intents.update(**intent_kwargs)

if check("intent"):
self.intents.update(**{
Expand Down

0 comments on commit c6e7d3a

Please sign in to comment.