From 5698f12d58b57891ccab973a4c1b75a08b51af0a Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sun, 26 Nov 2017 04:58:52 +0000 Subject: [PATCH] Process individual servers instead of all for fetch messages --- discordbot/fetch_last_messages.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/discordbot/fetch_last_messages.py b/discordbot/fetch_last_messages.py index 484a2d8..5199163 100644 --- a/discordbot/fetch_last_messages.py +++ b/discordbot/fetch_last_messages.py @@ -69,7 +69,27 @@ class Titan(discord.Client): return print("working on this...") - all_channels = list(self.get_all_channels()) + all_channels = [] + if len(sys.argv) < 2: + print("fetch_last_messages.py [server_id]") + await self.logout() + return + if "server" == sys.argv[1]: + server_id = sys.argv[2] + server = self.get_server(server_id) + if not server: + print("Server not found") + await self.logout() + return + print("Getting server: " + str(server)) + all_channels = server.channels + elif "all" == sys.argv[1]: + print("Getting all channels") + all_channels = list(self.get_all_channels()) + else: + print("fetch_last_messages.py [server_id]") + await self.logout() + return for channel in all_channels: try: if str(channel.type) == "text":