sendNotification

sendNotification(string title, [string message]) → boolean sent
Sends you a notification. It arrives at the end of the fight, among your other notifications, with a link to the fight, and can also go out as a push notification or an email depending on your settings for the Fight category. At most 50 notifications per day, counted from midnight across all your fights, test fights included: the following ones are ignored. Example: function afterFight() {'{'} sendNotification('Fight over', 'Turn ' + getTurn() + ', ' + getLife() + ' HP left') {'}'}

Sends you a notification. It arrives at the end of the fight, among your other notifications, with a link to the fight, and can also go out as a push notification or an email depending on your settings for the Fight category. A good place to call it is often afterFight() (see Fight hooks), when the outcome of the fight is known.

At most 50 notifications per day, counted from midnight (Paris time) across all your fights, test fights included: the following ones are ignored. To keep this quota for real fights, check the context with getFightContext. The title and the message fit on one line: a line break becomes a space.

// Called automatically at the end of the fight
function afterFight() {
	// Not in a test fight: keep the daily quota for real fights
	if (getFightContext() != FIGHT_CONTEXT_TEST && isDead(getEntity())) {
		sendNotification('Defeat', 'Died on turn ' + getTurn() + ', ' + getAliveEnemiesCount() + ' enemy(ies) still standing')
	}
}
// Called automatically at the end of the fight
function afterFight() {
	// Not in a test fight: keep the daily quota for real fights
	if (Fight.context !== Fight.Context.TEST && Fight.me.dead) {
		System.sendNotification('Defeat', 'Died on turn ' + Fight.turn + ', ' + Fight.getAliveEnemiesCount() + ' enemy(ies) still standing')
	}
}

// In TypeScript and JavaScript, hooks are only called if the AI defines turn()
function turn() {
	// ...
}
# Called automatically at the end of the fight
def afterFight():
	# Not in a test fight: keep the daily quota for real fights
	if Fight.context != Fight.Context.TEST and Fight.me.dead:
		System.sendNotification('Defeat', 'Died on turn ' + str(Fight.turn) + ', ' + str(Fight.getAliveEnemiesCount()) + ' enemy(ies) still standing')

# In Python, hooks are only called if the AI defines turn()
def turn():
	pass
Parameters
Return