Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
alice/src/auth/session.json
**/session.json
23 changes: 0 additions & 23 deletions alice/index.js

This file was deleted.

3 changes: 0 additions & 3 deletions alice/scripts/bot.js

This file was deleted.

18 changes: 0 additions & 18 deletions alice/scripts/commands.js

This file was deleted.

26 changes: 0 additions & 26 deletions alice/scripts/links.js

This file was deleted.

15 changes: 0 additions & 15 deletions alice/scripts/utils/parse.js

This file was deleted.

23 changes: 23 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { Alice } = require('./src/Alice');
const build = require('./src/build');

const path = new build.Path(__dirname);

const alice = new Alice([
path.create('src/commands/bot', 'bot'),
path.create('src/commands/coin', 'coin'),
path.create('src/commands/commands', 'commands'),
path.create('src/commands/cron', 'cron'),
path.create('src/commands/dice', 'dice'),
path.create('src/commands/doc', 'doc'),
path.create('src/commands/doc', 'help'),
path.create('src/commands/github', 'github'),
path.create('src/commands/links', 'links'),
path.create('src/commands/lyric', 'lyric'),
path.create('src/commands/report', 'report'),
path.create('src/commands/search', 'search'),
path.create('src/commands/suggest', 'suggest'),
path.create('src/commands/wiki', 'wiki'),
]);

alice.initialize();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "alice",
"version": "0.0.8",
"description": "A multipurpose system based on Inside Heartz whatsapp bot",
"main": "alice/index.js",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/Coding-in-community/alice"
Expand Down
2 changes: 1 addition & 1 deletion alice/src/index.js → src/Alice.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const auth = require('./auth');
const { Parse } = require('./parse');
const { Parse } = require('./utils/Parse');
const build = require('./build');

const session = new auth.Session();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/commands/bot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = () =>
`Olá, eu sou a Alice. Quer saber mais sobre mim? use o comando !doc`;
File renamed without changes.
15 changes: 15 additions & 0 deletions src/commands/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = () =>
`Os seguintes comandos estão disponiveis:
- !bot
- !coin
- !commands
- !cron
- !dice
- !doc
- !github
- !links
- !lyric
- !report
- !search
- !suggest
- !wiki`.trim();
3 changes: 1 addition & 2 deletions alice/scripts/cron.js → src/commands/cron.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const events = require('events');
const chattools = require('./utils/chattools');
const time = require('./utils/time');
const { chattools, time } = require('../utils');

const emitter = new events.EventEmitter();
let threads = [];
Expand Down
2 changes: 1 addition & 1 deletion alice/scripts/dice.js → src/commands/dice.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Ele deve ser escrito na forma <multiplicador>d<quantidade de lados>+<valor adici
Caso seja passado o valor adicional, ele deve ser escrito sem espaços, ou será considerado nulo.
Ex:
- !dice 1d10 + 4 // Joga um dado de dez lados mas *não* faz a soma.
`;
`.trim();

module.exports = (data) => {
const { text } = data;
Expand Down
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions src/commands/links.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = () =>
`Coding in python:
https://chat.whatsapp.com/I4IpHC0YFPQLUcGHJeqYdF

Coding in C/C++:
https://chat.whatsapp.com/Csn56Bpj8hVIQ3FiZoxBKh

Coding in Javascript:
https://chat.whatsapp.com/IUXcqbAPdJC2IuNfd7aaF5

Coding in PHP:
https://chat.whatsapp.com/C6wcXZhyT869Q29PIL1J20

Coding in Java:
https://chat.whatsapp.com/KDjc7IoCAYWAjCAwNEJ5cF

Coding on Linux:
https://chat.whatsapp.com/D37sPPhUsiT5LZ8PQeqg4t

Coding in Taberna:
https://chat.whatsapp.com/GOXnIXSXEFH7wHvO9aTuFs

Speaking in English:
https://chat.whatsapp.com/EOirNapuFe3CVunBqbwj1Z
`.trim();
2 changes: 1 addition & 1 deletion alice/scripts/lyric.js → src/commands/lyric.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const axios = require('axios');
const JSSoup = require('jssoup').default;
const search = require('./utils/search');
const { search } = require('../utils');

async function makeSoup(url) {
const { data } = await axios.get(url);
Expand Down
4 changes: 2 additions & 2 deletions alice/scripts/report.js → src/commands/report.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const parse = require('./utils/parse');
const { chattools } = require('../utils');

const myID = parse.userID('+55 11 96734-3809');
const myID = chattools.userID('+55 11 96734-3809');
const strings = {
defaultMessage: `
uso: _!report [--flag] [descrição]_
Expand Down
2 changes: 1 addition & 1 deletion alice/scripts/search.js → src/commands/search.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const search = require('./utils/search');
const { search } = require('../utils');

function callback(object) {
const { title, link, snippet } = object;
Expand Down
4 changes: 2 additions & 2 deletions alice/scripts/suggest.js → src/commands/suggest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const parse = require('./utils/parse');
const { chattools } = require('../utils');

const myID = parse.userID('+55 11 96734-3809');
const myID = chattools.userID('+55 11 96734-3809');
const defaultMessage = `
uso: _!suggest [--flag] [sugestão]_

Expand Down
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions alice/scripts/utils/chattools.js → src/utils/chattools.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,22 @@ async function isAdm(message) {
return admList.includes(author);
}

function userID(targetNumber) {
if (typeof targetNumber !== 'string') {
throw new Error('you must pass the number as a string');
}

const target = targetNumber.replace(/\D/g, '');
const regexp = /\d+/;
const matches = target.match(regexp);
const pattern = matches[0];
return `${pattern}@c.us`;
}

module.exports = {
getAdmsList,
getMembersList,
getSerialList,
isAdm,
userID,
};
8 changes: 8 additions & 0 deletions src/utils/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable global-require */

module.exports = {
Parse: require('./Parse'),
chattools: require('./chattools'),
search: require('./search'),
time: require('./time'),
};
File renamed without changes.
File renamed without changes.