Skip to content
Sign upLog in
← Back to Community

Web tab not appearing on node.js

Profile icon
[deleted]

Hello i just wanna ask, how do i make the web tab appear on mobile view via node.js, i install the express but it didn't work either. What should i do?

Answered by tussiez [earned 5 cycles]
View Answer
Voters
Profile icon
tussiez
Comments
hotnewtop
Profile icon
tussiez

The code you're running needs to be in index.js, if it is not already. Repl.it runs the code in index.js when you press the Run button.

Profile icon
[deleted]

@tussiez
Fixed, thanks for you're help. <3

Profile icon
tussiez

@josshuapancipan
No problem! :)

Profile icon
SixBeeps

You need to actually start a server for the web view to show up, just installing Express won't be enough.

Profile icon
[deleted]

@SixBeeps
Hmmm, i already have a (server.js) so.... How?

Profile icon
[deleted]

Server.js code:

const Discord = require("discord.js");
const fs = require("fs");
const client = new Discord.Client();
const fetch = require("node-fetch");
const { Prefix, Token, Color } = require("./config.js");
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
client.db = require("quick.db");

client.on("ready", async () => {
console.log(ready!);
client.user
.setActivity(Servers : ${await client.guilds.cache.size} | Users : 1, {
type: "PLAYING"
})
.catch(error => console.log(error));
});

client.on("message", async message => {
if (message.channel.type === "dm") return;
if (message.author.bot) return;
if (!message.guild) return;
if (!message.member)
message.member = await message.guild.fetchMember(message);

if (message.content.match(new RegExp(^<@!?${client.user.id}>))) {
return message.channel.send(Bot Prefix : ${Prefix});
}
});

let modules = ["fun", "info", "moderation"];

modules.forEach(function(module) {
fs.readdir(./commands/${module}, function(err, files) {
if (err)
return new Error(
"Missing Folder Of Commands! Example : Commands//.js"
);
files.forEach(function(file) {
if (!file.endsWith(".js")) return;
let command = require(./commands/${module}/${file});
console.log(${command.name} Command Has Been Loaded - ✅);
if (command.name) client.commands.set(command.name, command);
if (command.aliases) {
command.aliases.forEach(alias =>
client.aliases.set(alias, command.name)
);
}
if (command.aliases.length === 0) command.aliases = null;
});
});
});

client.on("message", async message => {
if (message.channel.type === "dm") return;
if (message.author.bot) return;
if (!message.guild) return;
if (!message.member)
message.member = await message.guild.fetchMember(message);

if (!message.content.startsWith(Prefix)) return;

const args = message.content
.slice(Prefix.length)
.trim()
.split(" ");
const cmd = args.shift().toLowerCase();

if (cmd.length === 0) return;

let command =
client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd));

if (!command) return;

if (command) {
if (!message.guild.me.hasPermission("ADMINISTRATOR"))
return message.channel.send(
"I Don't Have Enough Permission To Use This Or Any Of My Commands | Require : Administrator"
);
command.run(client, message, args);
}
console.log(
User : ${message.author.tag} (${message.author.id}) Server : ${message.guild.name} (${message.guild.id}) Command : ${command.name}
);
});

setInterval(async () => {
await fetch("https://mini-desert-organ.glitch.me").then(
console.log("Pinged")
);
}, 240000);

client.login(Token);