<commit_before>const TelegramBot = require('node-telegram-bot-api');
const config = require('./config.json');
const diceRoll = require('./commands/diceroll');
const urbanDic = require('./commands/urbandic');
const giphy = require('./commands/giphy');
const weather = require('./commands/weather');


const commands = {
  diceRoll,
  urbanDic,
  giphy,
  weather,
};

// Token from Bot Father
const token = config.telegramToken;

// Initalise Bot
const bot = new TelegramBot(token, { polling: true });

bot.getMe().then((me) => {
  // eslint-disable-next-line
  console.log(`Hi! I'm ${me.first_name}`);
});

// Matches "Hello"
bot.onText(/^(hello |hi |kia ora |hey )(!)?( dixon)?(!)?/ig, (msg) => {
  const chatId = msg.chat.id;
  bot.sendChatAction(chatId, 'typing');
  bot.sendMessage(chatId, 'Hello! 👋', {
    reply_to_message_id: msg.message_id,
    disable_notification: true,
  });
});


// Matches "/help"
bot.onText(/\/help/, (msg) => {
  const chatId = msg.chat.id;
  bot.sendChatAction(chatId, 'typing');
  bot.sendMessage(chatId, 'Help! \nDixon Bot was created by @imkieren \n\nCommands and Actions:\n[word].gif - Searches giphy and returns a gif\n/urbandic [word] - Searches Urban Dictionary for specified word\n/roll (number) - Rolls dice. 6 sides is default.\nWeather Update - Gives you weather update when you *send your location*', { parse_mode: 'markdown' });
});


// Matches "/roll [number]"
bot.onText(/\/(roll)( .+)?/, (msg, match) => {
  const chatId = msg.chat.id;
  // Send Typing Status
  bot.sendChatAction(chatId, 'typing');
  commands.diceRoll(match[2] || 6).then((value) => {
    bot.sendMessage(chatId, `🎲 ${value}`);
  }).catch((err) => {
    bot.sendMessage(chatId, `🚫Error! ${err}`);
  });
});

// Matches "/urbandic [word]"<commit_msg>Fix help menu not showing []<commit_after>const TelegramBot = require('node-telegram-bot-api');
const config = require('./config.json');
const diceRoll = require('./commands/diceroll');
const urbanDic = require('./commands/urbandic');
const giphy = require('./commands/giphy');
const weather = require('./commands/weather');


const commands = {
  diceRoll,
  urbanDic,
  giphy,
  weather,
};

// Token from Bot Father
const token = config.telegramToken;

// Initalise Bot
const bot = new TelegramBot(token, { polling: true });

bot.getMe().then((me) => {
  // eslint-disable-next-line
  console.log(`Hi! I'm ${me.first_name}`);
});

// Matches "Hello"
bot.onText(/^(hello |hi |kia ora |hey )(!)?( dixon)?(!)?/ig, (msg) => {
  const chatId = msg.chat.id;
  bot.sendChatAction(chatId, 'typing');
  bot.sendMessage(chatId, 'Hello! 👋', {
    reply_to_message_id: msg.message_id,
    disable_notification: true,
  });
});


// Matches "/help"
bot.onText(/\/help/, (msg) => {
  const chatId = msg.chat.id;
  bot.sendChatAction(chatId, 'typing');
  bot.sendMessage(chatId, 'Help! \nDixon Bot was created by @imkieren \n\nCommands and Actions:\n[[word]].gif - Searches giphy and returns a gif\n/urbandic [word] - Searches Urban Dictionary for specified word\n/roll (number) - Rolls dice. 6 sides is default.\nWeather Update - Gives you weather update when you *send your location*', { parse_mode: 'markdown' });
});


// Matches "/roll [number]"
bot.onText(/\/(roll)( .+)?/, (msg, match) => {
  const chatId = msg.chat.id;
  // Send Typing Status
  bot.sendChatAction(chatId, 'typing');
  commands.diceRoll(match[2] || 6).then((value) => {
    bot.sendMessage(chatId, `🎲 ${value}`);
  }).catch((err) => {
    bot.sendMessage(chatId, `🚫Error! ${err}`);
  });
});

// Matches "/urbandic [word]"
{'fraction_non_alphanumeric': 0.193639178159302, 'fraction_numerical': 0.0016887137630171687, 'mean_word_length': 4.019774011299435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1925872', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1268, 'n_words': 290}