evennia.contrib.game_systems.mail.mail

In-Game Mail system

Evennia Contribution - grungies1138 2016

A simple Brandymail style @mail system that uses the Msg class from Evennia Core. It has two Commands, both of which can be used on their own:

  • CmdMail - this should sit on the Account cmdset and makes the mail command

available both IC and OOC. Mails will always go to Accounts (other players).

  • CmdMailCharacter - this should sit on the Character cmdset and makes the mail

command ONLY available when puppeting a character. Mails will be sent to other Characters only and will not be available when OOC.

  • If adding both commands to their respective cmdsets, you’ll get two separate

IC and OOC mailing systems, with different lists of mail for IC and OOC modes.

Installation:

Install one or both of the following (see above):

  • CmdMail (IC + OOC mail, sent between players)

    # mygame/commands/default_cmds.py

    from evennia.contrib.game_systems import mail

    # in AccountCmdSet.at_cmdset_creation:

    self.add(mail.CmdMail())

  • CmdMailCharacter (optional, IC only mail, sent between characters)

    # mygame/commands/default_cmds.py

    from evennia.contrib.game_systems import mail

    # in CharacterCmdSet.at_cmdset_creation:

    self.add(mail.CmdMailCharacter())

Once installed, use help mail in game for help with the mail command. Use ic/ooc to switch in and out of IC/OOC modes.

class evennia.contrib.game_systems.mail.mail.CmdMail(**kwargs)[source]

Bases: evennia.commands.default.muxcommand.MuxAccountCommand

Communicate with others by sending mail.

Usage:

@mail - Displays all the mail an account has in their mailbox @mail <#> - Displays a specific message @mail <accounts>=<subject>/<message>

  • Sends a message to the comma separated list of accounts.

@mail/delete <#> - Deletes a specific message @mail/forward <account list>=<#>[/<Message>]

  • Forwards an existing message to the specified list of accounts, original message is delivered with optional Message prepended.

@mail/reply <#>=<message>
  • Replies to a message #. Prepends message to the original message text.

Switches:

delete - deletes a message forward - forward a received message to another object with an optional message attached. reply - Replies to a received message, appending the original message to the bottom.

Examples

@mail 2 @mail Griatch=New mail/Hey man, I am sending you a message! @mail/delete 6 @mail/forward feend78 Griatch=4/You guys should read this. @mail/reply 9=Thanks for the info!

key = '@mail'
aliases = ['mail']
lock = 'cmd:all()'
help_category = 'general'
parse()[source]

Add convenience check to know if caller is an Account or not since this cmd will be able to add to either Object- or Account level.

search_targets(namelist)[source]

Search a list of targets of the same type as caller.

Parameters
  • caller (Object or Account) – The type of object to search.

  • namelist (list) – List of strings for objects to search for.

Returns

targetlist (Queryset) – Any target matches.

get_all_mail()[source]
Returns a list of all the messages where the caller is a recipient. These

are all messages tagged with tags of the mail category.

Returns

messages (QuerySet) – Matching Msg objects.

send_mail(recipients, subject, message, caller)[source]

Function for sending new mail. Also useful for sending notifications from objects or systems.

Parameters
  • recipients (list) – list of Account or Character objects to receive the newly created mails.

  • subject (str) – The header or subject of the message to be delivered.

  • message (str) – The body of the message being sent.

  • caller (obj) – The object (or Account or Character) that is sending the message.

func()[source]

Do the main command functionality

lock_storage = 'cmd:all();'
search_index_entry = {'aliases': 'mail', 'category': 'general', 'key': '@mail', 'no_prefix': 'mail mail', 'tags': '', 'text': '\n Communicate with others by sending mail.\n\n Usage:\n @mail - Displays all the mail an account has in their mailbox\n @mail <#> - Displays a specific message\n @mail <accounts>=<subject>/<message>\n - Sends a message to the comma separated list of accounts.\n @mail/delete <#> - Deletes a specific message\n @mail/forward <account list>=<#>[/<Message>]\n - Forwards an existing message to the specified list of accounts,\n original message is delivered with optional Message prepended.\n @mail/reply <#>=<message>\n - Replies to a message #. Prepends message to the original\n message text.\n Switches:\n delete - deletes a message\n forward - forward a received message to another object with an optional message attached.\n reply - Replies to a received message, appending the original message to the bottom.\n Examples:\n @mail 2\n @mail Griatch=New mail/Hey man, I am sending you a message!\n @mail/delete 6\n @mail/forward feend78 Griatch=4/You guys should read this.\n @mail/reply 9=Thanks for the info!\n\n '}
class evennia.contrib.game_systems.mail.mail.CmdMailCharacter(**kwargs)[source]

Bases: evennia.contrib.game_systems.mail.mail.CmdMail

Communicate with others by sending mail.

Usage:

@mail - Displays all the mail an account has in their mailbox @mail <#> - Displays a specific message @mail <accounts>=<subject>/<message>

  • Sends a message to the comma separated list of accounts.

@mail/delete <#> - Deletes a specific message @mail/forward <account list>=<#>[/<Message>]

  • Forwards an existing message to the specified list of accounts, original message is delivered with optional Message prepended.

@mail/reply <#>=<message>
  • Replies to a message #. Prepends message to the original message text.

Switches:

delete - deletes a message forward - forward a received message to another object with an optional message attached. reply - Replies to a received message, appending the original message to the bottom.

Examples

@mail 2 @mail Griatch=New mail/Hey man, I am sending you a message! @mail/delete 6 @mail/forward feend78 Griatch=4/You guys should read this. @mail/reply 9=Thanks for the info!

account_caller = False
aliases = ['mail']
help_category = 'general'
key = '@mail'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': 'mail', 'category': 'general', 'key': '@mail', 'no_prefix': 'mail mail', 'tags': '', 'text': '\n Communicate with others by sending mail.\n\n Usage:\n @mail - Displays all the mail an account has in their mailbox\n @mail <#> - Displays a specific message\n @mail <accounts>=<subject>/<message>\n - Sends a message to the comma separated list of accounts.\n @mail/delete <#> - Deletes a specific message\n @mail/forward <account list>=<#>[/<Message>]\n - Forwards an existing message to the specified list of accounts,\n original message is delivered with optional Message prepended.\n @mail/reply <#>=<message>\n - Replies to a message #. Prepends message to the original\n message text.\n Switches:\n delete - deletes a message\n forward - forward a received message to another object with an optional message attached.\n reply - Replies to a received message, appending the original message to the bottom.\n Examples:\n @mail 2\n @mail Griatch=New mail/Hey man, I am sending you a message!\n @mail/delete 6\n @mail/forward feend78 Griatch=4/You guys should read this.\n @mail/reply 9=Thanks for the info!\n\n '}