Skip to content

Commit

Permalink
Merge PR #78 from TheBastionBot/dev
Browse files Browse the repository at this point in the history
Bastion Bot v6.4.0
  • Loading branch information
iamtraction committed Dec 29, 2017
2 parents c88876c + 8b261df commit 4cc7bf5
Show file tree
Hide file tree
Showing 33 changed files with 758 additions and 98 deletions.
16 changes: 4 additions & 12 deletions bastion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ case $1 in

--show)
if [[ $(screengrepname) ]]; then
tail -f screenlog.0
tail -f bastion.log
else
echo -e "$NAME is currently ${RED}stopped${NC}!"
fi
Expand All @@ -51,9 +51,8 @@ case $1 in
else
echo -e "${CYAN}[Bastion]:${NC} Checking System..."
if [ -r bastion.js ]; then
rm -f screenlog.0
echo -e "${CYAN}[Bastion]:${NC} System Checked. O7" && echo -e "${CYAN}[Bastion]:${NC} Booting up..."
screen -dmS "$NAME" -L /bin/bash -c "until node .; do sleep 1; done"
screen -dmS "$NAME" -L "bastion.log" /bin/bash -c "until node .; do sleep 1; done"
echo -e "${GREEN}$NAME was successfully started!${NC} If you have any problems, see the log using '$0 --show' or start $NAME in dubug mode using '$0 --debug'!"
else
echo -e "${RED}[ERROR] System Check Failed.${NC}" && echo -e "Check if you have Bastion Bot installed correctly." && exit 1
Expand Down Expand Up @@ -85,7 +84,7 @@ case $1 in
echo "Updating $NAME..."
git pull origin master 1>/dev/null || (echo -e "${CYAN}[Bastion]: ${RED} Unable to download update files. Please check your internet connection.\\n" && exit 1)
echo "Updating dependencies..."
rm -fr node_modules package-lock.json
rm -fr node_modules package-lock.json bastion.log
npm install --only=production --no-optional --no-package-lock 1>/dev/null 2>update.log || (echo -e "${CYAN}[Bastion]: ${RED} Failed installing dependencies. Please see update.log file and report it, if it's really an issue.\\n" && exit 1)
echo -e "${CYAN}[Bastion]:${NC} Ready to boot up and start running."
fi
Expand All @@ -101,7 +100,7 @@ case $1 in
mv data/Bastion.sqlite "data/backup_${modifiedDate}.sqlite"
fi
echo "Deleting old files..."
rm -fr node_modules data/Bastion.sqlite package-lock.json
rm -fr node_modules data/Bastion.sqlite package-lock.json bastion.log
echo "Updating $NAME..."
git pull origin master 1>/dev/null || (echo -e "${CYAN}[Bastion]: ${RED} Unable to download update files. Please check your internet connection.\\n" && exit 1)
echo "Updating dependencies..."
Expand All @@ -122,13 +121,6 @@ case $1 in
grep -qF "LC_ALL=\"$LANG\"" /etc/environment || echo "LC_ALL=\"$LANG\"" | sudo tee -a /etc/environment 1>/dev/null
;;

--fix-p)
echo -e "${CYAN}[Bastion]:${NC} Fixing permissions..."
(
cd .. && sudo chown -R "$USER":"$(id -gn "$USER")" Bastion .config
)
;;

*)
echo
echo -e "${CYAN}Bastion${NC}"
Expand Down
33 changes: 19 additions & 14 deletions changes.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
{
"date": "December 15, 2017",
"date": "December 29, 2017",
"fixed": [
"`createChannel` command will now work as expected.",
"`serverInfo` will work even if your server has huge no. of emojis.",
"`streamerRole` will show a friendly error if no streamer role was set, rather than being unresponsive.",
"Killed the bugs that caused Bastion not to recognize uncached users and not respond to them.",
"Under-the-hood fixes"
"`deleteChannel` will now work as expected.",
"Fixed module name case sensitivity for `commands` command. You can now pass the module name in mixed cases.",
"A command in every module was hiding *below the fold*, won't happen anymore. Every command is now displayed *ATF* (with colors).",
"Under-the-hood changes"
],
"improved": [
"`help` command won't suggest you to join the Bastion Discord Server if you use it in the Bastion Discord Server, it didn't made sense.",
"Rewritten `commands` command. `commands` will show the list of modules by default, specifying a module with the command will show the list of commands in that module.",
"Nifty changes to the `changeLog` command. Didn't you notice it already?",
"Meld `leaderboard` and `hallOfFame` commands!",
"Under-the-hood improvements"
"`roleColor` can now be used with `roleColour` too",
"Bastion will now message the user personally after they have won the giveaway.",
"User permission in command help are now clearer.",
"Patrons and Donators (donating via PayPal) can now *get up to 15x more Bastion Currencies* when using the `daily` command."
],
"added": [],
"removed": [
"Still having the `hallOfFame` command after melding it with `leaderboard` command was useless."
"added": [
"Hey Garfield lovers, try the new `garfield` command for a cool garfield comic.",
"Added `destiny2` command for all gamers playing Destiny 2. Check out your and your stats right in Discord.",
"Added `pokemon` command for all those Pokémon fans. You can now get information on any Pokémon you want.",
"Added `coinMarketCap` command. Keep tabs on the market capitalization of various cryptocurrencies.",
"Easily see what permission Bastion has in a channel/server using the new `checkPermissions` command.",
"Added `giveXP` command so that bot owners can give experience points to anyone they want and increase their level anytime they want. Because they do what they want to do.",
"Use the all new `userLookup` command to fetch basic information about a user from Discord, works for ANY (yeah, ANY) Discord user.",
"**Animated emoji!** Shake your booties, because you can now use the `animoji` command to use the animated emojis of your server. Oh yeah, anyone can use it, Nitro isn't required."
],
"removed": [],
"issues": []
}
1 change: 0 additions & 1 deletion locales/en/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"connection": "Some error has occured while receiving data from the server. Please try again later.",
"cooldown": "%var% you've recently used this command. Please try again later.\n`%var%` command can only be used once in **%var%** minutes.",
"serverNotFound": "Bastion cannot find the server at %var%.\n• Check the address for typing errors such as **ww**.example.com instead of **www**.example.com\n• Connection may have been timed out, try again later.",
"deleteDefaultChannel": "You cannot delete the default channel.",
"eitherOneInVC": "Either one of us should be in a voice channel.",
"favSongsNotFound": "There are no songs in your favourite songs list.",
"gamblingCooldown": "%var% you have recently gambled in this game, please wait at least %var% seconds before gambling again.",
Expand Down
8 changes: 8 additions & 0 deletions locales/en/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"fun": {
"airhorn": "Plays an airhorn in a voice channel.",
"animoji": "Sends a large version of the specified animated emoji of your Discord server. And Nitro isn't required.",
"blockText": "Sends the given text as text emojis.",
"cat": "Shows a random picture of a cat.",
"catFact": "Shows a random fact about cats.",
Expand All @@ -26,6 +27,7 @@
"fidgetSpinner": "Spins a fidget spinner for you and shows for how long it was spinning.",
"flipText": "Sends the same message that you had sent, but flipped.",
"fortune": "Shows you a fortune from a fortune cookie.",
"garfield": "Shows you a garfield comic.",
"hello": "Get greetings from Bastion.",
"leet": "Sends the same message that you had sent, but as leet text.",
"pirateSpeak": "Sends the same message that you had sent, but as pirate speak.",
Expand Down Expand Up @@ -53,6 +55,7 @@
"battlefield4": "Get stats of any Battlefield 4 player.",
"callOfDuty4": "Get stats of any Call of Duty 4: Modern Warfare game server.",
"counterStrikeGlobalOffensive": "Get stats of any Counter-Strike: Global Offensive game server.",
"destiny2": "Get stats of any Destiny 2 player.",
"minecraft": "Get stats of any Minecraft game server.",
"overwatch": "Get stats of any Overwatch player.",
"paladins": "Get stats of any Paladins player.",
Expand Down Expand Up @@ -133,6 +136,7 @@
"channelID": "Shows ID of a specified channel of your Discord server.",
"channelInfo": "Shows information of a specified text or voice channel of your Discord server.",
"channelTopic": "Shows the channel topic of text channel of your Discord server.",
"checkPermissions": "Shows the permissions Bastion has in the server/channel.",
"discrim": "Searches for the users of your Discord server for the specifed discriminator.",
"emojiInfo": "Shows information of a specifed emoji of your Discord server.",
"inRole": "Shows members that have a specifed role in your Discord server.",
Expand All @@ -150,6 +154,7 @@
"stats": "Shows detailed stats and info of Bastion.",
"userID": "Shows ID of a specified user of your Discord server.",
"userInfo": "Shows information of a specified user of your Discord server.",
"userLookup": "Fetches basic information of a user from Discord.",
"viewPermissions": "Shows the permissions you have in the server/channel.",
"xp": "Shows the experience points of the specified user's account."
},
Expand Down Expand Up @@ -183,6 +188,7 @@
"gift": "Send gifts to other users from the gift items you have with you.",
"giftShop": "Shows the products available in the gift shop, and their price.",
"give": "Give the specified amount of Bastion Currencies from your account to the specified user. If you are the bot owner, you can give any amount of Bastion Currencies.",
"giveXP": "Give the specified amount of experience points to the specified user and increase their level.",
"leaderboard": "Shows the top 10 users topping the chart.",
"myGifts": "Shows the gifts you currently have in your possession.",
"take": "Take the specified amount of Bastion Currencies from the specified user."
Expand Down Expand Up @@ -246,6 +252,7 @@
"capture": "Captures a screenshot of the specified webpage.",
"choose": "Asks the bot to choose an option from a number of options.",
"cite": "Cite any message from your Discord server.",
"coinMarketCap": "Shows market capitalization of the specified cryptocurrency.",
"colour": "Convert the provided color in `HEX` format to `RGB`, `CMYK`, `HSL`, `HSV`, `HWB`, `LAB`, `ANSI16`, `ANSI256`, `XYZ`, `HCG`, `Apple`, `Gray` and `CSS` Keyword (Approximates to closest color) formats.",
"date": "Shows the local date and time of any specified city.",
"define": "Searches the definition of the specified word from English, French or German dictionary.",
Expand All @@ -264,6 +271,7 @@
"map": "Get the map of the specified location.",
"morseCode": "Encodes a given text in Morse Code.",
"movie": "Searches for the details of a movie.",
"pokemon": "Shows you information on the specified Pokémon.",
"poll": "Starts a poll in the current text channel asking users to vote.",
"reminder": "Bastion sets a reminder to remind you of specified message, via direct message, after a specified duration.",
"shorten": "Shortens a specified URL using Google URL Shortner.",
Expand Down
1 change: 0 additions & 1 deletion locales/es-es/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"connection": "Ocurrió un error meintras recivia los datos del servidor. Por favor, inténtalo más tarde.",
"cooldown": "%var% recientemente ha utilizado este comando. Por favor Inténtalo más tarde. '%var%' comando sólo puede ser utilizado una vez en ** %var% ** minutos.",
"serverNotFound": "Bastion no puede encontrar el servidor en %var%.\n•Compruebe la dirección de los errores de escritura como ** ww **. Example.com en lugar de ** www **. Example.com\n•• Es posible que se haya agotado el tiempo de conexión, vuelva a intentarlo más tarde.",
"deleteDefaultChannel": "No puedes eliminar el canal predeterminado.",
"eitherOneInVC": "Cualquiera de nosotros debería estar en un canal de voz.",
"favSongsNotFound": "No hay canciones en tu lista de canciones favoritas.",
"gamblingCooldown": "%var% has jugado recientemente en este juego, por favor, espera al menos %var% segundos antes de jugar de nuevo.",
Expand Down
1 change: 0 additions & 1 deletion locales/fr/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"commandNoDisable": "Vous ne pouvez pas désactiver la commande %var%.",
"connection": "Une erreur s’est produite lors de la réception de données depuis le serveur. Veuillez réessayer ultérieurement.",
"serverNotFound": "Bastion ne peux pas trouver le serveur à l'adresse suivante : %var%.\n• Vérifiez l'adresse pour les fautes de frappe comme **ww**.example.com au lieu **www**.example.com\n• La connexion pourrait être expirée, veuillez réessayer plus tard.",
"deleteDefaultChannel": "Vous ne pouvez pas supprimer le canal par défaut.",
"eitherOneInVC": "L'un de nous devrait être dans un canal vocal.",
"favSongsNotFound": "Il n'y a aucune musiques dans votre liste de chansons favorites.",
"gamblingCooldown": "%var% vous avez joué récemment à ce jeu, veuillez patienter au moins %var% secondes avant de jouer à nouveau.",
Expand Down
3 changes: 1 addition & 2 deletions locales/nl/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"connection": "Een fout is opgetreden bij het ontvangen van gegevens van de server. Probeer het later nog eens.",
"cooldown": "%var%, Je hebt recentelijk dit commando gebruikt... Probeer het later opnieuw.\nHet `%var%` commando kan alleen elke **%var%** minuten worden gebruikt.",
"serverNotFound": "Bastion kan de server niet vinden op %var%.\n• Controleer het adres voor typefouten, zoals **ww**.voorbeeld.com in plaats van **www**.voorbeeld.com\n• Misschien is er een probleem met de verbinding, probeer het later opnieuw.",
"deleteDefaultChannel": "Je kunt het standaard kanaal niet verwijderen.",
"eitherOneInVC": "Een van ons moet zich in een gesprekskanaal bevinden.",
"favSongsNotFound": "Er zijn geen favorieten in de lijst toegevoegd.",
"gamblingCooldown": "%var% je hebt recentelijk gegokt met dit spel, wacht minimaal %var% seconden om opnieuw te gokken in dit spel.",
Expand Down Expand Up @@ -76,4 +75,4 @@
"userNoVC": "%var% Je moet in een gesprekskanaal zitten om gebruik te maken van dit commando.",
"weatherNotFound": "Er zijn geen weergegevens gevonden voor die locatie."
}
}
}
3 changes: 1 addition & 2 deletions locales/tr-cy/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"connection": "Sunucudan veri alınırken bir hata oluştu. Lütfen daha sonra yeniden deneyin.",
"cooldown": "`%var%`, Son zamanlarda bu komutunu kullandınız. Lütfen daha sonra yeniden deneyin. '%var%' komutu yalnızca kullanılabilir bir kez içinde ** %var% Dakika Kullanılabilir.",
"serverNotFound": "Bastion %var% 'da sunucuyu bulamıyor.\n• ** www **. Example.com yerine ** ww **. Example.com gibi yazım hataları için adresi kontrol edin.\n• Bağlantı zaman aşımına uğradı, daha sonra tekrar deneyin.",
"deleteDefaultChannel": "Varsayılan olarak belirlenmiş kanalı silemezsiniz.",
"eitherOneInVC": "En az bir kişi ses kanalında olmalı.",
"favSongsNotFound": "En sevdiğiniz şarkı listesine şarkı yok.",
"gamblingCooldown": "Son zamanlarda bu oyunda kumar oynadı %var% lütfen bekleyin daha önce yine kumar en az %var% saniye.",
Expand Down Expand Up @@ -76,4 +75,4 @@
"userNoVC": "Bu komutu kullanmak için bir ses kanalı olmak gerekir %var%.",
"weatherNotFound": "Hava veri için belirtilen konumu bulundu."
}
}
}
1 change: 0 additions & 1 deletion locales/tr/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"connection": "Sunucudan veri alınırken bir hata oluştu. Lütfen daha sonra yeniden deneyin.",
"cooldown": "`%var%`, Son zamanlarda bu komutunu kullandınız. Lütfen daha sonra yeniden deneyin. '%var%' komutu yalnızca kullanılabilir bir kez içinde ** %var% Dakika Kullanılabilir.",
"serverNotFound": "Bastion %var% 'da sunucuyu bulamıyor.\n• ** www **. Example.com yerine ** ww **. Example.com gibi yazım hataları için adresi kontrol edin.\n• Bağlantı zaman aşımına uğradı, daha sonra tekrar deneyin.",
"deleteDefaultChannel": "Varsayılan olarak belirlenmiş kanalı silemezsiniz.",
"eitherOneInVC": "En az bir kişi ses kanalında olmalı.",
"favSongsNotFound": "En sevdiğiniz şarkı listesinde şarkı yok.",
"gamblingCooldown": "Son zamanlarda bu oyunda kumar oynadı %var% lütfen bekleyin daha önce yine kumar en az %var% saniye.",
Expand Down
66 changes: 29 additions & 37 deletions modules/administration/deleteChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,40 @@
*/

exports.exec = async (Bastion, message, args) => {
let channel = message.mentions.channels.first();
if (!channel) {
channel = message.channel;
if (args.id) {
channel = message.guild.channels.get(args.id);
try {
let channel = message.mentions.channels.first();
if (!channel) {
channel = message.channel;
if (args.id) {
channel = message.guild.channels.get(args.id);
}
else if (args.name) {
channel = message.guild.channels.find('name', args.name.join(' '));
}
if (!channel) {
/**
* Error condition is encountered.
* @fires error
*/
return Bastion.emit('error', Bastion.strings.error(message.guild.language, 'notFound'), Bastion.strings.error(message.guild.language, 'channelNotFound', true), message.channel);
}
}
else if (args.name) {
channel = message.guild.channels.find('name', args.name.join(' '));

if (!channel.permissionsFor(message.member).has(this.help.userTextPermission)) {
/**
* User has missing permissions.
* @fires userMissingPermissions
*/
return Bastion.emit('userMissingPermissions', this.help.userTextPermission);
}
if (!channel) {
if (!channel.permissionsFor(message.guild.me).has(this.help.botPermission)) {
/**
* Error condition is encountered.
* @fires error
*/
return Bastion.emit('error', Bastion.strings.error(message.guild.language, 'notFound'), Bastion.strings.error(message.guild.language, 'channelNotFound', true), message.channel);
* Bastion has missing permissions.
* @fires bastionMissingPermissions
*/
return Bastion.emit('bastionMissingPermissions', this.help.botPermission, message);
}
}

if (!channel.permissionsFor(message.member).has(this.help.userTextPermission)) {
/**
* User has missing permissions.
* @fires userMissingPermissions
*/
return Bastion.emit('userMissingPermissions', this.help.userTextPermission);
}
if (!channel.permissionsFor(message.guild.me).has(this.help.botPermission)) {
/**
* Bastion has missing permissions.
* @fires bastionMissingPermissions
*/
return Bastion.emit('bastionMissingPermissions', this.help.botPermission, message);
}

if (channel.id === message.guild.defaultChannel.id) {
/**
* Error condition is encountered.
* @fires error
*/
return Bastion.emit('error', Bastion.strings.error(message.guild.language, 'forbidden'), Bastion.strings.error(message.guild.language, 'deleteDefaultChannel', true), message.channel);
}

try {
await channel.delete();

if (channel.id === message.channel.id) return;
Expand Down
2 changes: 1 addition & 1 deletion modules/administration/roleColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ exports.exec = async (Bastion, message, args) => {
};

exports.config = {
aliases: [],
aliases: [ 'roleColour' ],
enabled: true,
argsDefinitions: [
{ name: 'name', type: String, multiple: true, defaultOption: true },
Expand Down
40 changes: 40 additions & 0 deletions modules/fun/animoji.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @file animoji command
* @author Sankarsan Kampa (a.k.a k3rn31p4nic)
* @license MIT
*/

exports.exec = (Bastion, message, args) => {
if (!args.name) {
/**
* The command was ran with invalid parameters.
* @fires commandUsage
*/
return Bastion.emit('commandUsage', message, this.help);
}

let emoji = message.guild.emojis.find('name', args.name);

if (emoji) {
message.channel.send({
files: [ emoji.url.replace(/\.png$/, '.gif') ]
}).catch(() => {});
}
};

exports.config = {
aliases: [ 'animote' ],
enabled: true,
argsDefinitions: [
{ name: 'name', type: String, defaultOption: true }
]
};

exports.help = {
name: 'animoji',
botPermission: '',
userTextPermission: 'ADD_REACTIONS',
userVoicePermission: '',
usage: 'animoji <ANIMATED_EMOJI_NAME>',
example: [ 'animoji PartyWumpus' ]
};
Loading

0 comments on commit 4cc7bf5

Please sign in to comment.