xernerx 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,7 +77,7 @@ class Functions {
77
77
 
78
78
  for (const argument of command.args) {
79
79
 
80
- let content = message.content.split(separator).slice(i + 1);
80
+ let content = message.content.replace(new RegExp(`${separator}${separator}+`, "g"), separator).split(separator).slice(i + 1);
81
81
 
82
82
  if (content.join(separator) != '') {
83
83
 
@@ -85,6 +85,10 @@ class Functions {
85
85
  args[argument.name] = content[0];
86
86
  }
87
87
 
88
+ else if (argument.type == 'string') {
89
+ args[argument.name] = content[0];
90
+ }
91
+
88
92
  else if (argument.type == 'number') {
89
93
  args[argument.name] = parseInt(content[0]);
90
94
  }
@@ -96,19 +100,25 @@ class Functions {
96
100
 
97
101
  else if (argument.type == 'user') {
98
102
  let user;
99
- try { user = await message.client.users.fetch(content[0].replace(/<@|>/g, "")) } catch (e) { user = e }
103
+ try { user = await message.client.users.fetch(content[0].replace(/<?@?!?|>?/g, "")) } catch (e) { user = e }
100
104
  args[argument.name] = user;
101
105
  }
102
106
 
107
+ else if (argument.type == 'role') {
108
+ let role;
109
+ try { role = await message.guild.roles.fetch(content[0].replace(/<?@?&?|>?/g, "")) } catch (e) { role = e }
110
+ args[argument.name] = role;
111
+ }
112
+
103
113
  else if (argument.type == 'member') {
104
114
  let member;
105
- try { member = await message.guild.members.fetch(content[0].replace(/<@|>/g, "")) } catch (e) { member = e }
115
+ try { member = await message.guild.members.fetch(content[0].replace(/<?@?!?|>?/g, "")) } catch (e) { member = e }
106
116
  args[argument.name] = member;
107
117
  }
108
118
 
109
119
  else if (argument.type == 'channel') {
110
120
  let channel;
111
- try { channel = await message.client.channels.fetch(content[0].replace(/<#|>/g, "")) } catch (e) { channel = e }
121
+ try { channel = await message.client.channels.fetch(content[0].replace(/<?#\?|>?/g, "")) } catch (e) { channel = e }
112
122
  args[argument.name] = channel;
113
123
  }
114
124
 
@@ -35,7 +35,7 @@ class EventHandler {
35
35
  }
36
36
  }
37
37
 
38
- if (logging) console.info(logStyle(`Loaded events: ${events.join(', ')}`, 'text', 'purple'));
38
+ if (logging || this.client.logging) console.info(logStyle(`Loaded events: ${events.join(', ')}`, 'text', 'purple'));
39
39
 
40
40
  const builderFiles = fs.readdirSync(`${__dirname}/../events`).filter(file => file.endsWith('.js'))
41
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xernerx",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "A bot framework for discord.js. [BETA]",
5
5
  "main": "main.js",
6
6
  "scripts": {