Im trying to make a command, which makes => x+(x*0,3)
like, when someones does: /pp 1
that x = 1 or smth and then the bot makes: 1+(1x0,3) and then that the bot output this: New Price: 1,30$
Discord.JS v12
Related
I am making a discord bot with pycord, but when I added a command to get the latest post of a twitter account the bot stops working.
The bot sends the 5 latest posts and then adds them to a list to not send the same post twice.
But after posted.append(twitter.id) the bot stops reacting to other commands.
I can't figure out what is happening.
async def get_latest_post(ctx):
tweets = await twitter.get_users_tweets(id="1299389003477573632", max_results=5)
posted = []
while True:
for tweet in tweets.data:
if tweet.id in posted:
pass
else:
await ctx.respond(
f"https://twitter.com/twitter/statuses/{tweet.id}"
)
posted.append(tweet.id)
I Want To Set System Channel Messages With Discordjs v12
i tried:
message.guild.systemChannel.set(channel)
But It Doesent Work
First you should look for the specific channel like:
const testChannel = client.channels.cache.find(channel => channel.name === "yourchannelname");
and then:
message.guild.systemChannel.set(testChannel)
I would do it when client.once is ready or guildMemberAdd
Let me remind you that this is working for me in discord.js 12.5.1 and last version is 13.5.0
I don't know how to do this, but I want to make like if i say !list and bot will show all the server my bot in and then i want to do like !invite (server name) and bot will make an invite link and send to me.
This should do the trick
let guilds = '';
<client>.guilds.cache.forEach((guild) => {
guilds = guilds.concat(guild).concat("\n"); // Adds a new line after each guild
});
console.log(guilds);
And of course you can adjust / format this for your needs :)
Sort of like how the Groovy bot automatically self-defans, im wondering how to do the same thing but opposite and for muting. Basically when the bot detects it has been server muted, it will automatically un-server mute. Thanks!
This might work:
client.on('voiceStateUpdate', (oldState, newState) => {
if(newState.id === client.user.id && newState.serverMute) newState.setMute(false); // unmute bot
});
Currently, I have a command in my bot where it will react to anything with discord.gg in the message. I want the bot to be able to post the embed message each time a discord invite is posted, but delete the last embed message it sent so it would look like the bot is keeping one specific message at the end of a channel.
This is what the code looks like right now, thank you for your help!
let keyword15 = ["discord.gg"];
if (msg.author.bot) return;
if((msg.content.toLowerCase().includes(keyword15) )
){
const embed2 = new Discord.MessageEmbed()
.setDescription('Promotion Operator \n ▫️ **Do not post outside the advertisement channel.** \n ▫️ **Do not advertise your server via DM.**')
.setColor(0x000000)
msg.channel.send(embed2);
}
I wouldn't know how to delete the last embed but, I have came up with another solution you could try.
let keyword15 = ["discord.gg"];
if (msg.author.bot) return;
if((msg.content.toLowerCase().includes(keyword15) )
){
const embed2 = new Discord.MessageEmbed()
.setDescription('Promotion Operator \n ▫️ **Do not post outside the advertisement channel.** \n ▫️ **Do not advertise your server via DM.**')
.setColor(0x000000)
msg.channel.send(embed2).then(msg => {
msg.delete(300000)
});
}
that there will delete the embed after 5 minutes, You can always change the time, Just keep in mind discord uses milliseconds so if you want to use 10 minutes you would have to put in 600000, etc.