Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/data/ems_lines.json

Large diffs are not rendered by default.

306 changes: 306 additions & 0 deletions assets/data/suicide_hotlines.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
[
{
"Country": "United States of America",
"Hotline": "988"
},
{
"Country": "Algeria",
"Hotline": "00213983200058"
},
{
"Country": "Argentina",
"Hotline": "135"
},
{
"Country": "Armenia",
"Hotline": "2538194"
},
{
"Country": "Australia",
"Hotline": "131114"
},
{
"Country": "Bahamas",
"Hotline": "3222763"
},
{
"Country": "Bolivia",
"Hotline": "3911270"
},
{
"Country": "Bosnia & Herzegovina",
"Hotline": "080050305"
},
{
"Country": "Bulgaria",
"Hotline": "0035924917223"
},
{
"Country": "Canada",
"Hotline": "18334564566"
},
{
"Country": "China",
"Hotline": "8008101117"
},
{
"Country": "Costa Rica",
"Hotline": "5062535439"
},
{
"Country": "Cyprus",
"Hotline": "80007773"
},
{
"Country": "Denmark",
"Hotline": "4570201201"
},
{
"Country": "Dominican Republic",
"Hotline": "8095623500"
},
{
"Country": "Egypt",
"Hotline": "131114"
},
{
"Country": "El Salvador",
"Hotline": "126"
},
{
"Country": "Estonia",
"Hotline": "3726558088"
},
{
"Country": "Finland",
"Hotline": "010195202"
},
{
"Country": "France",
"Hotline": "0145394000"
},
{
"Country": "Germany",
"Hotline": "08001110111"
},
{
"Country": "Ghana",
"Hotline": "233244471279"
},
{
"Country": "Guatemala",
"Hotline": "53925953"
},
{
"Country": "Guyana",
"Hotline": "2230001"
},
{
"Country": "Holland",
"Hotline": "09000767"
},
{
"Country": "Hong Kong",
"Hotline": "85223820000"
},
{
"Country": "Hungary",
"Hotline": "116123"
},
{
"Country": "India",
"Hotline": "8888817666"
},
{
"Country": "Indonesia",
"Hotline": "18002738255"
},
{
"Country": "Iran",
"Hotline": "1480"
},
{
"Country": "Ireland",
"Hotline": "4408457909090"
},
{
"Country": "Israel",
"Hotline": "1201"
},
{
"Country": "Italy",
"Hotline": "800860022"
},
{
"Country": "Jamaica",
"Hotline": "18884295273"
},
{
"Country": "Japan",
"Hotline": "810352869090"
},
{
"Country": "Jordan",
"Hotline": "110"
},
{
"Country": "Kenya",
"Hotline": "722178177"
},
{
"Country": "Kuwait",
"Hotline": "94069304"
},
{
"Country": "Latvia",
"Hotline": "37167222922"
},
{
"Country": "Lebanon",
"Hotline": "1564"
},
{
"Country": "Liberia",
"Hotline": "6534308"
},
{
"Country": "Lithuania",
"Hotline": "880028888"
},
{
"Country": "Luxembourg",
"Hotline": "352454545"
},
{
"Country": "Malaysia",
"Hotline": "062842500"
},
{
"Country": "Malta",
"Hotline": "179"
},
{
"Country": "Mauritius",
"Hotline": "2308009393"
},
{
"Country": "Mexico",
"Hotline": "5255102550"
},
{
"Country": "Netherlands",
"Hotline": "9000113"
},
{
"Country": "New Zealand",
"Hotline": "1737"
},
{
"Country": "Nigeria",
"Hotline": "2348092106493"
},
{
"Country": "Norway",
"Hotline": "4781533300"
},
{
"Country": "Peru",
"Hotline": "3813695"
},
{
"Country": "Philippines",
"Hotline": "028969191"
},
{
"Country": "Poland",
"Hotline": "5270000"
},
{
"Country": "Portugal",
"Hotline": "218540740"
},
{
"Country": "Romania",
"Hotline": "0800801200"
},
{
"Country": "Russia",
"Hotline": "0078202577577"
},
{
"Country": "Saint Vincent and the Grenadines",
"Hotline": "97844561044"
},
{
"Country": "São Tomé and Príncipe",
"Hotline": "2392221222"
},
{
"Country": "Serbia",
"Hotline": "381216623393"
},
{
"Country": "Singapore",
"Hotline": "18002214444"
},
{
"Country": "Spain",
"Hotline": "914590050"
},
{
"Country": "South Africa",
"Hotline": "0514445691"
},
{
"Country": "South Korea",
"Hotline": "027158600"
},
{
"Country": "Sri Lanka",
"Hotline": "0110572222662"
},
{
"Country": "Sudan",
"Hotline": "24911555253"
},
{
"Country": "Sweden",
"Hotline": "46317112400"
},
{
"Country": "Switzerland",
"Hotline": "143"
},
{
"Country": "Thailand",
"Hotline": "027136793"
},
{
"Country": "Tonga",
"Hotline": "23000"
},
{
"Country": "Trinidad and Tobago",
"Hotline": "8686452800"
},
{
"Country": "Uganda",
"Hotline": "0800212121"
},
{
"Country": "United Arab Emirates",
"Hotline": "80046342"
},
{
"Country": "United Kingdom",
"Hotline": "08006895652"
},
{
"Country": "Zambia",
"Hotline": "260960264040"
},
{
"Country": "Zimbabwe",
"Hotline": "08012333333"
}
]
53 changes: 53 additions & 0 deletions src/discord/commands/global/d.ems.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import {
SlashCommandBuilder,
} from 'discord.js';
import { SlashCommand } from '../../@types/commandDef';
import { embedTemplate } from '../../utils/embedTemplate';
import { ems } from '../../../global/commands/g.ems';

export const emsCommand : SlashCommand = {
data: new SlashCommandBuilder().setName('ems')
.setDescription('Gets list of EMS Lines for the provided countries matching the query')
.addStringOption(option => option.setName('country_search').setDescription('The string to search for country name').setRequired(true))
.addBooleanOption(option => option.setName('ephemeral')
.setDescription('Set to "True" to show the response only to you')),
async execute(interaction) {
await interaction.deferReply({ ephemeral: (interaction.options.getBoolean('ephemeral') === true) });
const data = await ems(interaction.options.getString('country_search') || '');
if (data.length === 0) {
await interaction.editReply(':x: No Countries Found');
return true;
}
const fields = data.slice(0, 24).map(dataEntry => {
let valueStr = dataEntry.LocalOnly
? 'Local numbers only'
: `${dataEntry.Suicide ? `Suicide Hotline: \`${dataEntry.Suicide}\`` : ''}`
+ `${dataEntry.Ambulance.All && dataEntry.Ambulance.All[0] != null && dataEntry.Ambulance.All[0] != '' ? `\nAmbulance: ${dataEntry.Ambulance.All.map((num: string) => `\`${num}\``).join(', ')}` : ''}`
+ `${dataEntry.Ambulance.GSM || dataEntry.Ambulance.Fixed ? `\nAmbulance GSM: ${dataEntry.Ambulance.GSM ? dataEntry.Ambulance.GSM.map((num: string) => `\`${num}\``).join(', ') : ''}\nAmbulance Landline: ${dataEntry.Ambulance.Fixed ? dataEntry.Ambulance.Fixed.map((num: string) => `\`${num}\``).join(', ') : ''}` : ''}`
+ `${dataEntry.Police.All && dataEntry.Police.All[0] != null && dataEntry.Police.All[0] != '' ? `\nPolice: ${dataEntry.Police.All.map((num: string) => `\`${num}\``).join(', ')}` : ''}`
+ `${dataEntry.Police.GSM || dataEntry.Police.Fixed ? `\nPolice GSM: ${dataEntry.Police.GSM ? dataEntry.Police.GSM.map((num: string) => `\`${num}\``).join(', ') : ''}\nPolice Landline: ${dataEntry.Police.Fixed ? dataEntry.Police.Fixed.map((num: string) => `\`${num}\``).join(', ') : ''}` : ''}`
+ `${dataEntry.Fire.All && dataEntry.Fire.All[0] != null && dataEntry.Fire.All[0] != '' ? `\nFire: ${dataEntry.Fire.All.map((num: string) => `\`${num}\``).join(', ')}` : ''}`
+ `${dataEntry.Fire.GSM || dataEntry.Fire.Fixed ? `\nFire GSM: ${dataEntry.Fire.GSM ? dataEntry.Fire.GSM.map((num: string) => `\`${num}\``).join(', ') : ''}\nFire Landline: ${dataEntry.Fire.Fixed ? dataEntry.Fire.Fixed.map((num: string) => `\`${num}\``).join(', ') : ''}` : ''}`
+ `${dataEntry.Dispatch.All && dataEntry.Dispatch.All[0] != null && dataEntry.Dispatch.All[0] != '' && dataEntry.Dispatch.All[0].length > 0 ? `\nGeneral Dispatch: ${dataEntry.Dispatch.All.map((num: string) => `\`${num}\``).join(', ')}` : ''}`
+ `${dataEntry.Dispatch.GSM || dataEntry.Dispatch.Fixed ? `\nDispatch GSM: ${dataEntry.Dispatch.GSM ? dataEntry.Dispatch.GSM.map((num: string) => `\`${num}\``).join(', ') : ''}\nDispatch Landline: ${dataEntry.Dispatch.Fixed ? dataEntry.Dispatch.Fixed.map((num: string) => `\`${num}\``).join(', ') : ''}` : ''}`
+ `${dataEntry.Member_112 ? `\nDispatch Alias: \`112\` ` : ''}`;
valueStr = valueStr.substring(0, 1024); // trim for discord
if (!valueStr.trim()) {
valueStr = 'No data available';

}
return {
name: `**${dataEntry.Country.Name.substring(0, 256)}**`, // Limit name length
value: valueStr,
inline: true,
};
});
const embed = embedTemplate().setFields(fields).setTitle(`EMS Numbers for countries matching: ${interaction.options.getString('country_search') || ''}`)/* .setDescription('\n**DONT HESITATE TO CALL EMS IF YOU OR SOMEONE YOU KNOW IS IN DANGER**') */;
if (data.length > 24) {
embed.setFooter({ text: 'Results clipped (24 Max). Narrow your search! • Dose Responsibly' });
}
await interaction.editReply({ embeds: [embed] });
return true;
},
};
export default emsCommand;
Loading