(Discord selfbot) Is there anyway to response if 'hi' in someone message - discord

Is there anyway to make the selfbot response 'hello' if 'hi' is in someone message?
Like
A: hi? Anyone here?
The bot: hello
The bot response because 'hi' is in A's message.
I think it's not possible because i tried many Discord selfbot library and none of library work (Python)

Which library are you using?
I made a discord bot with discord.js (Javascript), and with that you can receive an event every time someone talks in your discord server and then respond depending on the contents of the message.
First you start your discord client (the Intents may vary depending on what you want to do):
const discordClient = new Client({ intents: [Intents.FLAGS.DIRECT_MESSAGES, Intents.FLAGS.GUILD_MESSAGES] })
Then the idea is to get the content of every new message and answer properly, once you have created your discord client, you will need to set up an event listener like this one:
discordClient.on('messageCreate', message => {
const content = messageReceived.content.toLocaleLowerCase()
if (content === 'hi') {
messageReceived.channel.send("hello, I'm a bot!")
}
})
And don't forget to login with your discord bot key
const discordKey = "YOUR DISCORD BOT KEY"
discordClient.login(discordKey)
You can also see the repository for my bot here.
And for your use case you would want to mainly focus on some parts insid discord.ts.
Hopefully this helps.

Here are some basic examples using discord.js within node.js.
Simple Response
To send a response, simply check if the user's message contains the desired input you want your bot to respond to.
if(message.content.toLowerCase().includes("ping") {
message.reply("Pong!")
}
Multiple Responses
This is a much more efficient method of responding to multiple inputs. This includes using an array.
const array = [
"hello",
"hola",
"bonjour"
]
if(array.some(word => message.content.toLowerCase().includes(`${word}`)) {
message.reply("Hello!")
}

Here's the code
---Starts From Here:---
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// Only respond to messages containing "hi", "hey", "hello", or "sup"
if (context.params.event.content.match(/hi|hey|hello|sup/i)) {
let messageContent = context.params.event.content.match(/hi|hey|hello|sup/i);
await lib.discord.channels['#0.3.0'].messages.create({
channel_id: context.params.event.channel_id,
content: `${messageContent[0]} to you too 👋`,
message_reference: {
message_id: context.params.event.id
}
});
}
--Ends--
Image of code
I suggest using autocode.com it will really help you in coding life. I use it myself.
Here's a small guide https://autocode.com/guides/how-to-build-a-discord-bot/

If your banned using discord selfbot, that's not my fault
from discord.ext import commands
client = commands.Bot(
command_prefix='-',
self_bot=True,
help_command=None
)
#client.event
async def on_message(message):
if message.author == client.user:
return
if message.content == 'Hello!':
await message.channel.send("Hi how your day!")
client.run('user token', bot=False)

Related

How to (and is it possible to) make link markup work in a discord bot message?

What I'm trying to achieve is simple:
send a message like links: [link1](https://example.com/1), [link1](https://example.com/2) via a bot
get it displayed as "links: link1, link1"
In a ephemeral follow up, it works as expected:
const content = "links: [link1](https://example.com/1), [link1](https://example.com/2)"
await interaction.followUp({
ephemeral: true,
content,
})
But when I send this to a public channel like this:
await channel.send(content)
I'm getting it as plain text (links: [link1](https://example.com/1), [link1](https://example.com/2)) except the links are clickable.
Is it possible to get the same result as in an ephemeral message?
I've checked the permissions, there's only "embed" links (which sounds like "allow links in embeds", and not "allow links in messages) and it is enabled anyway on server for everyone, for the bot and in the channel. So what am I missing here?
PS Here they say that "it's only possible if the message was sent with webhook though", but I'm not quite sure what does this mean (can this be different for a public and an ephemeral message?)
You cannot use hyper links in normal messages sent by a bot. You need to use a Webhook. Considering you're using discord.js, see this guide on their documentation. When using something like that it will work as expected
const { WebhookClient } = require('discord.js');
const webhookClient = new WebhookClient({ url: "WEBHOOK_URL" });
webhookClient.send({
content: "[Hello world](https://github.com)",
username: "Webhook Username",
});
Otherwise you may use embeds and send one of these with your bot and the content you wish to have.
Right, so I've found a solution based on suggestion by Krypton. As an embed doesn't look nice and manual creation of a webhook is not an option for me, I've found that I can create a webhook on the go and use it.
After some testing, I've figured that such webhooks are also permanent (although they can be found in another part of settings than the manually created ones); they should be deleted as there's a limit of 15 webhooks – an attempt to create more fails (with DiscordAPIError[30007]: Maximum number of webhooks reached (15)).
Instead of doing
await channel.send(content)
I've put
// a guard, TypeScript requires us to be sure
if(channel instanceof TextChannel) {
const webhook = await channel.createWebhook({
// a message from a webhook has a different sender, here we set its name,
// for instance the same as the name of our bot (likewise, we can set an avatar)
name: "MyBot",
})
await webhook.send(content)
await webhook.delete()
}
This seems to be a minimal code change to get the links working.

Discord: Reading messages from one channel in a (non-admin perm) server, and posting it to another (with admin perms)

I am new to Discord API framework.
ServerFROM is a public server that I was invited to (non-admin perms). Hence I cannot add bots there. But I can view the content in ChannelFROM (a text channel in ServerFROM)
I have my own ServerTO (in which I have admin perms and so can do anything). Inside of which, I have the target ChannelTO
I want to deploy a listener on ChannelFROM, such when there is a new message (announcement) in ChannelFROM, I want it to be read and reposted in ChannelTO.
Something similar to what is done in this Stackoverflow issue, except that I cannot have some script run locally 24x7 on my machine. Maybe use Github Actions or something similar?
How can I go about doing it? Any ideas are appreciated. Maybe some form of a server, or just a custom Discord bot
And thanks in advance.
you can use Custom bot for that. I dont know other way
here's how i do it
1st : We Get the ID of the Channel that you wanted to listen
2nd : We make a Output or where the bot copy the message from and send it
3rd : Bot required a permission to view the channel and send message
or in the nutshell ( sorry if im bad at explaining )
client.on("messageCreate", message => {
if(message.author.bot) return;
if(message.channel.id === ID_HERE) // ChannelFROM in ID_HERE
{
let MSG = message.content
let Author = message.member.displayName
let Avatar = message.author.displayAvatarURL({dynamic: true})
const Embed = new MessageEmbed()
.setAuthor(Author , Avatar )
.setDescription(MSG)
.setColor("RANDOM")
client.channels.cache.get(ID_HERE).send({ embeds: [Embed] }) // SendTo in ID_HERE
}
})
you can remove if(message.author.bot) return; if you want it also read other bot message on that specific channel

Discord: Get channel by ID returns undefined / null

I'm setting up a cron job to run a bot command that unlocks/locks a channel at a certain time every day. Trying to get the channel returns either undefined or null, depending on how I go about it.
The bot is added to the discord server and is online
require('dotenv').config();
const Discord = require("discord.js");
const client = new Discord.Client();
client.login(process.env.TOKEN);
const chan = client.channels.cache.get("858211703946084352");
console.log(chan);
const channel = client.channels.fetch("858211703946084352").then(res => {
console.log(res);
});
console.log(channel);
When I run it in the console I get
undefined
Promise { <pending> }
null
I have looked at many many examples and solutions, but none seem to resolve my issue
Edit:
bot has admin permissions.
I did the 'right click on channel and copy ID' technique, which matched the ID I got when I used dev tools to examine the element containing the channel name
There is a MEE6 bot in the server so I know bots can send messages
Edit2:
For fun and profit I deleted the app and remade it, same issue
I tried using a channel the MEE6 bot sends to, same issue
Try running this code in the ready event
client.on('ready', () => {
const chan = client.channels.cache.get("858211703946084352");
console.log(chan);
});

Creating a Discord bot to notify people when to certain text on a website has changed

const Discord = require('discord.js');
const bot = new Discord.Client();
const token = '';
bot.on('ready', () =>{
console.log('This bot is online');
})
bot.on('message', msg=>{
if(msg.content === "?rates"){
msg.reply('.')
}
})
bot.login(token);
This is what I have so far it is very basic, I understand, I'm just trying to get some sort of idea how to process. What I want is as soon as a website gets updated or changed. I would like it to tag everyone and in a certain channel and specifies what has changed. I know this will be a long process but I'm in for the ride :) would appreciate any help.
You need a webhook on the website and listen to it with your bot, if you have control over the site, this may help you, otherwise you could look if the site has one or perhaps ask an owner.
A probably working but not very nice (and not very clean) solution would be to save the text of the website every 5 seconds or so and compare it to the previous save. If it changed, you notify the members through sending a message.

How to create a discord bot that only allows a specific word in a certain text channel

I am trying to create a discord bot that only allows the word "upgrade" in a certain text channel.
As I am very new to this I would like to learn about how this is done.
Its easy. First create a bot. I guess you know about node.js if not, find tutorials for creating a project with discord.js.
First create a client:
const Discord = require("discord.js");
const client = new Discord.Client();
client.login("SuperSecretBotTokenHere");
(make sure you have a bot token) discordapp.com/developers
Then you create a message event:
client.on("message", (message) => {
if(message.content != "upgrade") return message.delete()
});
Put your bot in the server, give it permissions to delete messages in the channel aaand done!
Sorry for my bad English.

Resources