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
6 changes: 6 additions & 0 deletions .glitch-assets
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{"name":"drag-in-files.svg","date":"2016-10-22T16:17:49.954Z","url":"https://cdn.hyperdev.com/drag-in-files.svg","type":"image/svg","size":7646,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/drag-in-files.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(102, 153, 205)","uuid":"adSBq97hhhpFNUna"}
{"name":"click-me.svg","date":"2016-10-23T16:17:49.954Z","url":"https://cdn.hyperdev.com/click-me.svg","type":"image/svg","size":7116,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/click-me.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(243, 185, 186)","uuid":"adSBq97hhhpFNUnb"}
{"name":"paste-me.svg","date":"2016-10-24T16:17:49.954Z","url":"https://cdn.hyperdev.com/paste-me.svg","type":"image/svg","size":7242,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/paste-me.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(42, 179, 185)","uuid":"adSBq97hhhpFNUnc"}
{"uuid":"adSBq97hhhpFNUna","deleted":true}
{"uuid":"adSBq97hhhpFNUnb","deleted":true}
{"uuid":"adSBq97hhhpFNUnc","deleted":true}
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
# Sweetless
Hello?
# hello-express

A server that serves a webpage, its resources, and some data


## Your Project

On the front-end,

- Edit `views/index.html` to change the content of the webpage
- `public/client.js` is the javacript that runs when you load the webpage
- `public/style.css` is the styles for `views/index.html`
- Drag in `assets`, like images or music, to add them to your project

On the back-end,

- your app starts at `server.js`
- add frameworks and packages in `package.json`
- safely store app secrets in `.env` (nobody can see this but you and people you invite)

Click `Show` in the header to see your app live. Updates to your code will instantly deploy.


## Made by [Glitch](https://glitch.com/)

**Glitch** is the friendly community where you'll build the app of your dreams. Glitch lets you instantly create, remix, edit, and host an app, bot or site, and you can invite collaborators or helpers to simultaneously edit code with you.

Find out more [about Glitch](https://glitch.com/about).

( ᵔ ᴥ ᵔ )
34 changes: 34 additions & 0 deletions commands/Action/feed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const Discord = require("discord.js");
const superagent = require("superagent");

exports.run = async (client, message, args) => {
const user = message.mentions.users.first();

let mention;

if (!message.mentions.users.first()) {
mention = `${message.author.username} feeds ${client.user.username}`;
} else {
mention = `${message.author.username} feeds ${user.username}`;
}

const { body } = await superagent.get("https://nekos.life/api/v2/img/feed");

const feed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setAuthor(mention, message.author.displayAvatarURL({ format: "png", dynamic: true, size: 64 }))
.setImage(body.url)
return message.channel.send(feed);
}

exports.help = {
name: "feed",
description: "Feed someone.",
usage: ["feed", "feed <@user>"],
example: ["feed", "feed @Vii_Rakk#5424"]
}

exports.conf = {
aliases: [],
cooldown: 3
}
4 changes: 4 additions & 0 deletions commands/Action/module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Action",
"hide": false
}
34 changes: 34 additions & 0 deletions commands/Action/slap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const Discord = require("discord.js");
const superagent = require("superagent");

exports.run = async (client, message, args) => {
const user = message.mentions.users.first();

let mention;

if (!message.mentions.users.first()) {
mention = `${message.author.username} slap ${client.user.username}`;
} else {
mention = `${message.author.username} slap ${user.username}`;
}

const { body } = await superagent.get("https://nekos.life/api/v2/img/slap");

const slap = new Discord.MessageEmbed()
.setColor("RANDOM")
.setAuthor(mention, message.author.displayAvatarURL({ format: "png", dynamic: true, size: 64 }))
.setImage(body.url)
return message.channel.send(slap);
}

exports.help = {
name: "slap",
description: "slap someone.",
usage: ["slap", "slap <@user>"],
example: ["slap", "slap @Vii_Rakk#5424"]
}

exports.conf = {
aliases: [],
cooldown: 3
}
69 changes: 69 additions & 0 deletions commands/Developer/eval.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
const Discord = require("discord.js"),
{ post } = require("node-superfetch");

exports.run = async (client, message, args) => {
// This command is super frickin' dangerous. Make it only visible and usable for you only, or give it to someone you trust.
if (!client.config.owners.includes(message.author.id)) return;

const embed = new Discord.MessageEmbed()
.addField(":inbox_tray: Input", "```js\n" + args.join(" ") + "```");

try {
const code = args.join(" ");
if (!code) return message.channel.send("Please include the code.");
let evaled;

// This method is to prevent someone that you trust, open the secret shit here.
if (code.includes(`secret`) || code.includes(`token`) || code.includes("process.env")) {
evaled = "No, shut up, what will you do it with the token?";
} else {
evaled = eval(code);
}

if (typeof evaled !== "string") evaled = require("util").inspect(evaled, {depth: 0});

let output = clean(evaled);
if (output.length > 1024) {
// If the output was more than 1024 characters, we're gonna export them into the hastebin.
const {body} = await post("https://hastebin.com/documents").send(output);
embed.addField(":outbox_tray: Output", `https://hastebin.com/${body.key}.js`).setColor(0x7289DA);
// Sometimes, the body.key will turn into undefined. It might be the API is under maintenance or broken.
} else {
embed.addField(":outbox_tray: Output", "```js\n" + output + "```").setColor(0x7289DA)
}

message.channel.send(embed);

} catch (error) {
let err = clean(error);
if (err.length > 1024) {
// Do the same like above if the error output was more than 1024 characters.
const {body} = await post("https://hastebin.com/documents").send(err);
embed.addField(":outbox_tray: Output", `https://hastebin.com/${body.key}.js`).setColor("RED");
} else {
embed.addField(":outbox_tray: Output", "```js\n" + err + "```").setColor("RED");
}

message.channel.send(embed);
}
}

exports.help = {
name: "eval",
description: "Evaluate some code.",
usage: "eval <code>",
example: "eval client.commands"
}

exports.conf = {
aliases: ["ev"]
}

function clean(string) {
if (typeof text === "string") {
return string.replace(/`/g, "`" + String.fromCharCode(8203))
.replace(/@/g, "@" + String.fromCharCode(8203))
} else {
return string;
}
}
4 changes: 4 additions & 0 deletions commands/Developer/module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "developer",
"hide": true
}
42 changes: 42 additions & 0 deletions commands/Economy/balance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const Discord = require("discord.js");
const db = require("quick.db");

exports.run = async (client, message, args) => {
let user;
if (message.mentions.users.first()) {
user = message.mentions.users.first();
} else if (args[0]) {
user = message.guild.members.cache.get(args[0]).user;
} else {
user = message.author;
}

if (user.bot || user === client.user) {
return message.channel.send("This user is a bot.");
// If the user was a bot, ignore it.
}

let balance = db.get(`account.${user.id}.balance`);
if (!balance) balance = 0;
else balance = balance;

const embed = new Discord.MessageEmbed()
.setColor(0x7289DA)
.setTitle(`Balance of ${user.tag}`)
.addField("Balance", `$${(balance).toLocaleString()}`)
.setThumbnail(user.displayAvatarURL({size: 4096, dynamic: true}))
.setTimestamp(new Date) // Optional :)
return message.channel.send(embed);
}

exports.help = {
name: "balance",
description: "Checking yours, or other members money.",
usage: "balance [@user | user ID]",
example: "balance \nbalance @Vii_Rakk#5424"
}

exports.conf = {
aliases: ["bal", "coin", "money", "credit"],
cooldown: 5
}
44 changes: 44 additions & 0 deletions commands/Economy/daily.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");

exports.run = async (client, message, args) => {
let pad_zero = num => (num < 10 ? '0' : '') + num;
let cooldown = 8.64e+7; // 24 Hours in ms.
let amount = 500; // How much user will get it in their dailies.

let lastDaily = await db.get(`lastDaily.${message.author.id}`);
let buck = await db.get(`account.${message.author.id}.balance`);

try {

if (lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0) {
let timeObj = ms(cooldown - (Date.now() - lastDaily));

let hours = pad_zero(timeObj.hours).padStart(2, "0"),
mins = pad_zero(timeObj.minutes).padStart(2, "0"),
secs = pad_zero(timeObj.seconds).padStart(2, "0");

let finalTime = `**${hours}:${mins}:${secs}**`;
return message.channel.send(`Sorry, you cannot collect your dailies too early. Please wait until ${finalTime}.`);
} else {
db.set(`lastDaily.${message.author.id}`, Date.now());
db.add(`account.${message.author.id}.balance`, amount);
return message.channel.send(`Great **${message.author.tag}!** You've been received 500 dollars!`);
}

} catch (error) {
console.log(error);
return message.channel.send(`Oopsie, unknown error I guess: ${error}`);
}
}

exports.help = {
name: "daily",
description: "Collect the daily credits."
}

exports.conf = {
aliases: ["dailies"],
cooldown: 10
}
49 changes: 49 additions & 0 deletions commands/Economy/gamble.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");

exports.run = async (client, message, args) => {
const amount = parseInt(args[0]);
const result = Math.floor(Math.random() * 10);
const balance = db.get(`account.${message.author.id}.balance`);

if (!amount) return message.channel.send("Please insert an amount first.");
if (isNaN(amount)) return message.channel.send("The amount was not a number.");
if (amount > balance || !balance || balance === 0) return message.channel.send("You don't have enough money.");

// Optional:
if (amount < 200) return message.channel.send("You don't have enough money for gambling. The minimum was $200.");

let cooldown = 25000; // 25 Seconds.
let pad_zero = num => (num < 10 ? '0' : '') + num;
let lastGamble = await db.get(`lastGamble.${message.author.id}`);

if (lastGamble !== null && cooldown - (Date.now() - lastGamble) > 0) {
let timeObj = ms(cooldown - (Date.now() - lastGamble));
let second = pad_zero(timeObj.seconds).padStart(2, "0");
return message.channel.send(`Wooo that is too fast. You need to wait **${second}** second(s) before you can gambling again.`);
}

// 50:50
if (result < 5) {
await db.set(`lastGamble.${message.author.id}`, Date.now());
await db.subtract(`account.${message.author.id}.balance`, amount);
return message.channel.send(`Ahh, no. You lose $${amount}. Good luck next time.`);
} else if (result > 5) {
await db.set(`lastGamble.${message.author.id}`, Date.now());
await db.add(`account.${message.author.id}.balance`, amount);
return message.channel.send(`Woohoo! You won $${amount}! Good luck, have fun!`);
}
}

exports.help = {
name: "gamble",
description: "An efficient way to double your money.",
usage: "gamble <bet/amount>",
example: "gamble 500"
}

exports.conf = {
aliases: ["gambling"],
cooldown: 5
}
4 changes: 4 additions & 0 deletions commands/Economy/module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Economy",
"hide": false
}
43 changes: 43 additions & 0 deletions commands/Economy/transfer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const Discord = require("discord.js");
const db = require("quick.db");

exports.run = async (client, message, args) => {
let user;
if (message.mentions.users.first()) {
user = message.mentions.users.first();
} else if (args[0]) {
user = message.guild.members.cache.get(args[0]).user;
}

let balance = db.get(`account.${message.author.id}.balance`);

if (!user) return message.channel.send("Please mention the user or input the user ID.");
if (user.bot || user === client.user) return message.channel.send("This user is a bot.");
if (user.id === message.author.id || user === message.author) return message.channel.send("Why you want to transfer a credit to yourself?");

let amount = parseInt(args[1]);
if (!amount) return message.channel.send("Please input a credits that you want to transfer it.");
if (isNaN(amount)) return message.channel.send("Please input a valid number.");
// isNaN = is Not a Number.

if (!balance || balance == 0) return message.channel.send("Your wallet is empty.");
if (amount > balance) return message.channel.send("You don't have an enough credits to transfer. That is way too much.");
if (amount === 0) return message.channel.send("You transfer, nothing? No. You cannot.");

await db.add(`account.${user.id}.balance`, amount);
await db.subtract(`account.${message.author.id}.balance`, amount);

return message.channel.send(`You've been transferred to your friends (${user.tag}) $${amount} credits!`);
}

exports.help = {
name: "transfer",
description: "Transfer a credits to the user.",
usage: "transfer <@user | user ID> <amount>",
example: "transfer @Vii_Rakk#5424 1000"
}

exports.conf = {
aliases: ["tf"],
cooldown: 15
}
Loading