channels = []
for channel in client.get_all_channels():
if channel.is_private:
+ log.debug('Not a channel to greet: {} is private'.format(channel))
continue
if int(channel.id) not in [greeting['channel'] for greeting in greetings]:
+ log.debug('Not a channel to greet: {} not in {}'.format(channel, [greeting['channel'] for greeting in greetings]))
continue
+ log.debug('Channel to greet: {}'.format(channel))
channels.append(channel)
return channels
def should_greet_member_in(channel, member, role_name = 'Unassigned', minimum = 1):
if member not in channel.server.members:
+ log.debug('Not greeting {} not in server memberlist'.format(member))
return False
permissions = channel.permissions_for(member)
if permissions is None:
+ log.debug('Not greeting {} with no permissions'.format(member))
return False
if not permissions.read_messages:
+ log.debug('Not greeting {} with no read message permission'.format(member))
return False
if role_name in [role.name for role in member.roles]:
+ log.debug('Not greeting {} with {} role already'.format(member, role_name))
return False
if len(member.roles) > minimum:
+ log.debug('Not greeting {} with more than {} roles'.format(member, minimum))
return False
+ log.info('Greeting {} in {}'.format(member, channel.name))
return True
def voice_channel_for_channel(channel):