What is wrong with quick.db

I have a logs command but my bot is unable to fetch it
Here is the code for the fetch command:

if (value == "logs") {
  let lID = db.get(`${message.guild.id}.lChannel`)
let lChannel = message.guild.channels.get(lID);
if (!lChannel) message.channel.send("There is no log channel set");
    if (lChannel) {
      const embed = new RichEmbed()
        .setTitle('Log Channel')
        .setDescription(`The log channel is ${lChannel}`)
      message.channel.send(embed)
      
}
}

PLEASE HELP!

@charliea21 do you know what is happening?

@glitch_support Please help me

Begging for support most likely won’t get you any support

You could’ve spent this time constructing your query more and therefore giving us more details so we can help. All I know so far is something isn’t working. What isn’t working? Is there any errors?

no errors. it just can’t fetch the data for some reason.

Where are you setting your log channel? What command and what contents does it contain

here is the set command:
if (args[0] === “logs”) {
let lChannel = message.mentions.channels.first();

        if (!lChannel) {
            message.channel.send("That channel could not be found");
        }
    
        await db.set(`${message.guild.id}.lChannel`, lChannel.id);
        
      let sembed = new RichEmbed()
  .setTitle("Success")
  .setColor("#3FC83B")

.setDescription(The log channel has been set to <#${lChannel.id}>)
message.channel.send(sembed);
}

In the get command, could you add
console.log(lID)
After let lID = ...
Then run the get command and tell me the output of console

already tried that lol and the output was the channel id

Are you sure for the channel fetch, you didn’t mean to have it as

db.get(`${message.guild.id}`).lChannel

Ok, we’ve eliminated the possibility the database is fetching incorrectly. Could you now log lChannel.name into the console?

quick.db supports dot notation

1 Like

ok i will try that. (gotta add more characters lol)

it does log the channel name which is “logs” @SpeedyCraftah

OK so I’m slightly confused. What’s the unexpected behavior you’re experiencing? Which command? What message comes up if any

Screen Shot 2020-02-28 at 9.40.43 PM
This is the unexpected behaviour @SpeedyCraftah

Since I have no idea what’s happening, i have rewrote the get code, please replace everything inside value == logs with:

const lID = db.get(`${message.guild.id}.lChannel`);
if (!lID) return message.channel.send("There is no log channel set");

const lChannel = message.guild.channels.get(lID);
if (!lChanel) return message.channel.send("The log channel has been removed, set a new one");

const Embed = new RichEmbed()
    .setTitle('Log Channel')
    .setDescription(`The log channel is ${lChannel}`);

message.channel.send(Embed);

and give the command a try again

still does not work :frowning:

can you log db.get(${message.guild.id}) after you save it