mirror of
https://github.com/simon987/Discord-Channel-scraper.git
synced 2025-04-18 01:26:44 +00:00
Fixed error when no channel is specified
This commit is contained in:
parent
5a6e36daf4
commit
2074ee8d92
@ -77,8 +77,8 @@ async def get_logs(channel):
|
||||
log.info("Messages for channel {0} finished downloading".format(channel.name))
|
||||
except Exception as e:
|
||||
if not args.quiet:
|
||||
await client.send_message(channel, 'Failed saving logs: {}'.format(e.message))
|
||||
log.error("Error while downloading channel {0}: {1}".format(channel.name, e.message))
|
||||
await client.send_message(channel, 'Failed saving logs: {}'.format(str(e)))
|
||||
log.error("Error while downloading channel {0}: {1}".format(channel.name, str(e)))
|
||||
|
||||
|
||||
# Strangely, this will work once we are logged in
|
||||
@ -114,7 +114,8 @@ async def on_ready():
|
||||
await client.logout()
|
||||
elif args.server:
|
||||
log.info("Downloading messages for all channels in server {0}".format(args.server))
|
||||
for channel in server.channels:
|
||||
channels = [c for c in client.get_all_channels() if c.server.name == args.server]
|
||||
for channel in channels:
|
||||
await get_logs(channel)
|
||||
await client.logout()
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user