ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Общие вопросы программирования (https://forum.antichat.xyz/forumdisplay.php?f=206)
-   -   discord автоматические реакции на все сообщения (https://forum.antichat.xyz/showthread.php?t=1460565)

NORTEX666 08.12.2022 01:10

написал селфбота для дискорда который ставит на новые сообщения в указанном канале реакцию, хотелось бы что бы не нужно было менять код каждый раз и юзать это через команду типо .reaction

P.S скиньте доработанный код если такое можно сделать

мой код:





Код:

import
discord
import
asyncio
from
discord
.
ext
import
commands

client
=
commands
.
Bot
(
command_prefix
=
"."
,
self_bot
=
True
)
client
.
remove_command
(
"help"
)
token
=
"token"
@client.event
async
def
on_message
(
message
)
:
if
not
message
.
channel
.
id
==
(
айди канала типа
)
:
return
await
message
.
add_reaction
(
"🥶"
)
client
.
run
(
token
,
bot
=
False
)


teresen 08.12.2022 01:16

Попробуй это:

Код:





Код:

import discord
import asyncio
from discord.ext import commands

client = commands.Bot(command_prefix = ".", self_bot = True)
client.remove_command("help")

token = "token"

@client.event
async def on_message(message):
    channelId = message.channel.id
    if not channelId == (айди канала типа): return
    await message.add_reaction("🥶")

@client.command()
@commands.is_owner()
async def setReaction(ctx, channelId, reaction):
    if not ctx.message.channel.id == (айди канала типа): return
    @client.event
    async def on_message(message):
        if not message.channel.id == channelId: return
        await message.add_reaction(reaction)

client.run(token, bot = False)



Там допишешь свое, что нужно.

NORTEX666 08.12.2022 01:30

Цитата:

Сообщение от teresen

Попробуй это:

Код:





Код:

import discord
import asyncio
from discord.ext import commands

client = commands.Bot(command_prefix = ".", self_bot = True)
client.remove_command("help")

token = "token"

@client.event
async def on_message(message):
    channelId = message.channel.id
    if not channelId == (айди канала типа): return
    await message.add_reaction("🥶")

@client.command()
@commands.is_owner()
async def setReaction(ctx, channelId, reaction):
    if not ctx.message.channel.id == (айди канала типа): return
    @client.event
    async def on_message(message):
        if not message.channel.id == channelId: return
        await message.add_reaction(reaction)

client.run(token, bot = False)



Там допишешь свое, что нужно.

не работает

teresen 08.12.2022 01:37

Что именно не работает? Проверь права бота, дай мне лог, хоть что-нибудь.

NORTEX666 08.12.2022 01:40

Цитата:

Сообщение от teresen

Что именно не работает? Проверь права бота, дай мне лог, хоть что-нибудь.

какие права бота, я изначально написал что это селфбот, естественно я знаю что нужны права на проставление реакций и тд

Python:





Код:

import
discord
import
asyncio
from
discord
.
ext
import
commands

client
=
commands
.
Bot
(
command_prefix
=
"."
,
self_bot
=
True
)
client
.
remove_command
(
"help"
)
token
=
@client.command
(
)
async
def
asd
(
ctx
,
channelId
,
reaction
)
:
await
ctx
.
message
.
delete
(
)
if
not
ctx
.
message
.
channel
.
id
==
channelId
:
return
@client.event
async
def
on_message
(
message
)
:
if
not
message
.
channel
.
id
==
channelId
:
return
await
message
.
add_reaction
(
reaction
)
client
.
run
(
token
,
bot
=
False
)





пишу команду, указываю ид канала, реакцию в лог ничего не выдает но все равно ничего не происходит

vladsharik 08.12.2022 15:14

Цитата:

Сообщение от NORTEX666

какие права бота, я изначально написал что это селфбот, естественно я знаю что нужны права на проставление реакций и тд

Python:





Код:

import
discord
import
asyncio
from
discord
.
ext
import
commands

client
=
commands
.
Bot
(
command_prefix
=
"."
,
self_bot
=
True
)
client
.
remove_command
(
"help"
)
token
=
@client.command
(
)
async
def
asd
(
ctx
,
channelId
,
reaction
)
:
await
ctx
.
message
.
delete
(
)
if
not
ctx
.
message
.
channel
.
id
==
channelId
:
return
@client.event
async
def
on_message
(
message
)
:
if
not
message
.
channel
.
id
==
channelId
:
return
await
message
.
add_reaction
(
reaction
)
client
.
run
(
token
,
bot
=
False
)




пишу команду, указываю ид канала, реакцию в лог ничего не выдает но все равно ничего не происходит

Как мы тебе поможем если ты лог ошибки скинуть не можешь блять

laiser 09.12.2022 13:05

Цитата:

Сообщение от Vladius

Как мы тебе поможем если ты лог ошибки скинуть не можешь блять

зачем тебе лог? Ты же телепатией владеешь)

vladsharik 09.12.2022 20:12

Цитата:

Сообщение от laiser

зачем тебе лог? Ты же телепатией владеешь)

рил

Majunti 09.12.2022 20:22

юзал discord.js и горя бы не знал


Время: 16:35