#dose anyone know how to change the bots status to do not disturb or to and stats on command

1 messages · Page 1 of 1 (latest)

cinder adder
#

dose anyone know how to change the bots status to do not disturb or to and stats on command i am using v4

tall sirenBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

vagrant musk
#

You will not get any help for v4 since this version has been deprecated.

#

Try to look at status on v4 docs that's all I can say

cinder adder
#

ok

#

do you have one for any version

proper scroll
#

there is for V5

cinder adder
#

can you please send me it

vagrant musk
#

#1095206783880003626

cinder adder
#

dose this look right?

@listen()
async def on_startup():
change_presence(status=Status.DND, activity='SUP')

#

i dont know what to do with this one

#

async def change_presence(
self,
status: Optional[Union[str, Status]] = Status.ONLINE,
activity: Absent[Union[Activity, str]] = MISSING,
) -> None:
"""
Change the bots presence.

Args:
    status: The status for the bot to be. i.e. online, afk, etc.
    activity: The activity for the bot to be displayed as doing.

!!! note
    Bots may only be `playing` `streaming` `listening` `watching` or `competing`, other activity types are likely to fail.

"""
if activity is MISSING:
    activity = self.client.activity

elif activity is None:
    activity = []
else:
    if not isinstance(activity, Activity):
        # squash whatever the user passed into an activity
        activity = Activity.create(name=str(activity))

    if activity.type == ActivityType.STREAMING:
        if not activity.url:
            self.logger.warning("Streaming activity cannot be set without a valid URL attribute")
    elif activity.type not in [
        ActivityType.GAME,
        ActivityType.STREAMING,
        ActivityType.LISTENING,
        ActivityType.WATCHING,
        ActivityType.COMPETING,
    ]:
        self.logger.warning(f"Activity type `{ActivityType(activity.type).name}` may not be enabled for bots")
if status:
    if not isinstance(status, Status):
        try:
            status = Status[status.upper()]
        except KeyError:
            raise ValueError(f"`{status}` is not a valid status type. Please use the Status enum") from None
elif self.client.status:
    status = self.client.status
else:
    self.logger.warning("Status must be set to a valid status type, defaulting to online")
    status = Status.ONLINE

self.client._status = status
self.client._activity = activity
await self.gateway.change_presence(activity.to_dict() if activity else None, status)
cinder adder
#

Ok i will try that

#

This is my error in on_startup
await bot.change_presence(activity="something", status=Status.DO_NOT_DISTURB)
^^^^^^
NameError: name 'Status' is not defined

This is the code that i runed

@listen()
async def on_startup():
await bot.change_presence(activity="something", status=Status.DO_NOT_DISTURB)

#

ok

#

in on_startup
await bot.change_presence(status=Status.DO_NOT_DISTURB, activity="nothing")
^^^^^^
NameError: name 'Status' is not defined

#

ITs working so far thanks

cinder adder
#

do you have a script to keep it runing or somthin

cinder adder
#

do you have one so all my scripts run when my pc iss turned off

#

oh ok

#

a website

cinder adder
#

anyone know how to make a button panel

cinder adder
#

is this correct for a button panel or am i missing somthing

#

channel = bot.get_channel(1130433748232581161)
components = Button(
style=ButtonStyle.GREEN,
label="Click Me",
disabled=False,
)
components: list[ActionRow] = [
ActionRow(
Button(
style=ButtonStyle.GREEN,
label="Click Me",
),
Button(
style=ButtonStyle.GREEN,
label="Click Me Too",
)
)
]
await channel.send("Look, Buttons!", components=components)

#

But this is my error

#

line 341
await channel.send("Look, Buttons!", components=components)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: 'await' outside function

cinder adder
#

oh ok thanks

#

@cinder adder is there a way you can add await bot.change_presence(status=Status.IDLE, activity="working slowly") to a button when somone cickes it

cinder adder
#

@cinder adderis there a way you can do multiple buttons so if you click one it will set the bot to different staut

restive glacier
cinder adder
#

oh ok

restive glacier
#

Then add it in the on_component function

cinder adder
#

ok

#

@cinder adder is this right

@slash_command(
name="prepare",
description="Button prepare"
)
async def prepare(ctx: SlashContext):
channel = bot.get_channel(1130433748232581161)
components = Button(
style=ButtonStyle.GREEN,
label="Click Me",
custom_id="your_id",
disabled=False,
)
components: list[ActionRow] = [
ActionRow(
Button(
style=ButtonStyle.GREEN,
label="Click Me",
),
Button(
style=ButtonStyle.GREEN,
label="Click Me Too",
custom_id="dnd"
)
)
]
await channel.send("Look, Buttons!", components=components)
@listen
async def on_component(ctx: Component):
ctx = event.ctx
if ctx.custom_id == "your_id":
await bot.change_presence(status=Status.IDLE, activity="working slowly")

@listen
async def on_component(ctx: Component):
ctx = event.ctx
if ctx.custom_id == "dnd":
await bot.change_presence(status=Status.DND, activity="nothing")
await ctx.send("Changed to dnd")

cinder adder
cinder adder
#

k

#

i did

#

ok

#

its not working look There is no errors tho

#

@slash_command(
name="prepare",
description="Button prepare"
)
async def prepare(ctx: SlashContext):
channel = bot.get_channel(1130433748232581161)
components = [Button(
style=ButtonStyle.RED,
label="dnd",
custom_id="dnd",
disabled=False,
),
Button(
style=ButtonStyle.GREEN,
label="idle",
custom_id="idle",
disabled=False,
)]

@listen
async def on_component(ctx: Component):
ctx = event.ctx
if ctx.custom_id == "idle":
await bot.change_presence(status=Status.IDLE, activity="working slowly")

@listen
async def on_component(ctx: Component):
ctx = event.ctx
if ctx.custom_id == "dnd":
await bot.change_presence(status=Status.DND, activity="nothing")
await ctx.send("Changed to dnd")

#

Nope

#

@slash_command(
name="prepare",
description="Button prepare"
)
async def prepare(ctx: SlashContext):
channel = bot.get_channel(1130433748232581161)
components = Button(
style=ButtonStyle.GREEN,
label="Click Me",
disabled=False,
)
components: list[ActionRow] = [
ActionRow(
Button(
style=ButtonStyle.GREEN,
label="Click Me",
),
Button(
style=ButtonStyle.GREEN,
label="Click Me Too",
)
)
]
await channel.send("Look, Buttons!", components=components)

cinder adder
#

@cinder adder ok the buttons are showing but are not doing anything

#

ok

#

Done

#

@slash_command(
name="prepare",
description="Button prepare"
)
async def prepare(ctx: SlashContext):
channel = bot.get_channel(1130433748232581161)
components = Button(
style=ButtonStyle.GREEN,
label="Click Me",
disabled=False,
)
components: list[ActionRow] = [
ActionRow(
Button(
style=ButtonStyle.GREEN,
label="Click Me",
custom_id="idle"
),
Button(
style=ButtonStyle.GREEN,
label="Click Me Too",
custom_id="dnd"
)
)
]
await channel.send("Look, Buttons!", components=components)

cinder adder
#

@cinder adder

#

KK

#

@cinder adder i canrt make it so when you click a button is changes the bot to idle dnd

#

yes please

cinder adder
#

kk

#

@cinder adder How u goin with it

#

ye

#

Ok

#

i will try that

#

Thanks

cinder adder
#

Thanks it works

summer lark
#

guys, any ideas if this is possible to make bot status online on phone? cuz on one of my server i have bot with this status

cinder adder
#

DAMMMM

#

1 IN HOW MEANY

raw jasper
summer lark
#

welp i still want to know how tf creator of bot made this status

raw jasper
#

Part of the log in information for a user/bot is what platform it's running on. Users have mobile/desktop (might include os?), and bots send what library is being used

summer lark
#

i did little of research and i found how to make it in d.py

raw jasper
#

I'd look into the gateway part of the code for it

summer lark
#

if d.py users can make mobile status, then probably we can make it on i.py

raw jasper
rain walrus
#

okay, well, we've talked about this before actually

#

the gist of it: it is possible, but screws around with a lot of statistics collecting discord does thats important to this library and... also discord doesnt officially allow it

#

if you want to do it, go ahead, but it isnt being supported in ipy on any level

cinder adder
#

@cinder adder do you have a kick ban and timout command

tall sirenBOT
#
Application subcommands
Author

@vagrant musk

Timestamps

Created at: <t:1681840634:R>
Last edited: <t:1681842331:R>

Counts

Words: 40
Characters: 360

cinder adder
#

@cinder adder is there a way to send a user a dm with the discord bot

cinder adder
#

Thanks

#

@cinder adder U got anything for dm

#

A bot to user

#

So it becomes like a warn thing

cinder adder
#

where do i put .send can you please give me an example

#

oh my days

#

i need to learn more stuff

#

thanks

#

thanks

cinder adder
#

@cinder adder Is this right

@slash_command(
name="warn",
description="warn a member"
)
@slash_option(
name="member",
description="Member",
opt_type=OptionType.USER,
required=True
)
@slash_option(
name="reason",
description="reason",
required=False
)
async def warns(ctx: SlashContext, member: interactions.Member):
await member.send("{} reason{}.".format(member), ephemeral=True)
await ctx.send("Member {} was warned succefully.".format(member), ephemeral=True)

#

where

#

ok

#

This the error

line 413, in <module>
@slash_option(
^^^^^^^^^^^^^
TypeError: slash_option() missing 1 required positional argument: 'opt_type'

#

ok

#

I got an error @cinder adder
Traceback (most recent call last):
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\client\client.py", line 1890, in __dispatch_interaction
response = await callback
^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\client\client.py", line 1761, in _run_slash_command
return await command(ctx, **ctx.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\command.py", line 132, in call
await self.call_callback(self.callback, context)
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\application_commands.py", line 807, in call_callback
return await self.call_with_binding(callback, ctx, *new_args, **new_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\callback.py", line 43, in call_with_binding
return await callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\main.py", line 420, in warns
await member.send("{} reason{}.".format(member), ephemeral=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: Replacement index 1 out of range for positional args tuple

#

like this
await member.send("{} reason{}.".format(member) .format(reason), ephemeral=True)

#

kk

#

Traceback (most recent call last):
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\client\client.py", line 1890, in __dispatch_interaction
response = await callback
^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\client\client.py", line 1761, in _run_slash_command
return await command(ctx, **ctx.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\command.py", line 132, in call
await self.call_callback(self.callback, context)
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\application_commands.py", line 807, in call_callback
return await self.call_with_binding(callback, ctx, *new_args, **new_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\callback.py", line 43, in call_with_binding
return await callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\main.py", line 420, in warns
await member.send("{} reason{}.".format(member) .format(reason), ephemeral=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: Replacement index 1 out of range for positional args tuple

#

k

#

this is how it comes out @cinder adder reasonHi.

#

THIS IS A WARNING

@user so it pings them reason =...

#

it dosent ping the user tho

#

k

#

thanks