Skip to content

Non command functions

jellopudding edited this page Aug 3, 2016 · 3 revisions

findChannel(name)

Returns the channel object with the name name. If no channel found, returns -1

checkRole(user, roleRec)

Returns True if the user has the role roleRec. Returns False otherwise.

timeToTicks(time)

Returns the amount of ticks needed for desired time. time is a string that contains integers. This function looks for keywords like 'w', 'd', 'h', 'm', 's' & 't' and uses datetime.timedelta(...).total_seconds() to convert to seconds. If keywords 't', 'tick', 'ticks', or no keywords are found it is assumed the unit is ticks. If an undefined keyword is found a ValueError will be raised by int(...); in this case, the bot will respond with "Incorrect format".

timer()

An asyncio.coroutine function that calls on_tick() to do all the dirty work. Used to keep track of reminders and polls. Will be used in temp. channels, inactivity timers, etc.

on_channel_delete(channel)

A bot.event function that fires on a channel deletion. Used to announce channel deletions.

on_channel_create(channel)

A bot.event function that fires on channel creation. Used to announce channel creations.

on_member_join(member)

A bot.event function that fires when a new user joins the server. Used to announce new users to the server.

on_member_remove(member)

A bot.event function that fires when a user leaves the server. Used to announce users leaving the server.

on_command(command, ctx)

A bot.event function that fires when a command is sent in chat. Used to find the destination for a response and pass the content in the message.

on_tick()

An asyncio.coroutine function called by timer() to do all the dirty work. Used to keep track of reminders and polls. Will be used in temp. channels, inactivity timers, etc.

on_ready()

A bot.event function that fires when the bot is ready. Used to set up the bot in ways not done already.