riking / autodelete Goto Github PK
View Code? Open in Web Editor NEWA Discord bot that automatically deletes all messages in a designated channel on a rolling basis
License: Apache License 2.0
A Discord bot that automatically deletes all messages in a designated channel on a rolling basis
License: Apache License 2.0
Looking to self host to help lighten the load, but build is failing.
(Reading database ... 100%
(Reading database ... 15709 files and directories currently installed.)
Preparing to unpack .../linux-libc-dev_5.10.113-1_amd64.deb ...
Unpacking linux-libc-dev:amd64 (5.10.113-1) over (5.10.106-1) ...
Setting up linux-libc-dev:amd64 (5.10.113-1) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
git is already the newest version (1:2.30.2-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
go: go.mod file not found in current directory or any parent directory.
'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
like 'go install example.com/cmd@latest'
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.
The command '/bin/sh -c apt update -y --allow-insecure-repositories && apt upgrade -y && apt install -y git && apt -y clean && go get -u -v github.com/riking/AutoDelete/cmd/autodelete' returned a non-zero code: 1
exit status 1
Exit Code 1
when i try to inite the bot to my server a message that says bot requiers code grant pops up, this is the link for the invite i used https://tracr.co/bot/314230903872421889
After a single-message delete has been kicked off, the channel can be readded to the reaper queue, and the backlog reloaded, before the messages have finished being deleted. This can cause the messages to receive two deletion attempts, causing a flurry of errors.
I was fiddeling around with the autodelete time.
i set it to 1h first and after that set it to 24h.
The instantly shown message is correct with 24h delete time.
But after the first delete the bot shows only 1h of deletion time:
AutoDelete: Messages in this channel will be deleted after 1h0m0s.
The messages will still be deleted after 24h so i guess it might have to do with the previous 1h setting?
how difficult would it be to allow setting a particular point in time to purge all messages?
Use constants or flags for magic numbers: Instead of hardcoding values like time.Hour*1, "/debug/pprof/", and "/metrics", define them as constants or flags. This improves code readability and makes it easier to change these values in the future.
https://github.com/riking/AutoDelete/blob/master/commands.go#L114-L115
This can simply check for LPTS
When the queue for loading pinned messages is long, set
commands give a false completion mark instead of waiting for the backlog load to finish.
I'd like an option that for the message the bot leaves in the channel, Messages in this channel will be deleted after X
it also includes a relative timestamp as a sort of countdown to the next clearing.
Greetings, we have been using the bot for years now and once again it has happened that all our settings got reset and no messages were getting deleted. We had to re-set the bot in every channel manually.
Hello, I have my server very configured in chat, but one day the autodelet missed an error for something and then it stopped working on my main server, but it continues to work on the others, how can it be solved?
Set up the following:
Metrics exporting design: https://docs.google.com/document/d/1togd8BWjCM9_0QO7IP19qSprhJzc0IC3Fp_hjmPpYxA/edit#
Threads and messages in it aren't deleted.
I set up the bot in a channel with:
@AutoDelete set 72h
It gives the following warning and does nothing:
The number of messages in this channel is over 200. Messages may not be reliably deleted. (Saw: 200)
consider using a blocking operation such as time.Sleep to pause the execution of the program indefinitely. This avoids unnecessary CPU usage.
How can i start the File? I want to host it on repl.it, but how do i start it. i dont understand it
func (b *Bot) QueueLoadBacklog(c *ManagedChannel, didFail bool) {
c.mu.Lock() // <= nil pointer dereference
It will be nice if the bot supports filters to ignore some messages when deleting, it can be useful for channels that must keep some messages (or messages sent from a specific author) when deleting other messages.
Is it possible to have the bot ignore pinned messages, so that you can have a bot-command channel with a pinned message, and have all other messages deleted every 24 hours.
Normally bots we add to our server have permissions locked without any ability to modify them and their role has a locked symbol and always stays on top of the roles list. This makes it much cleaner and easier to see which role is for a bot only. Bots typically also do role names in a slug format "auto-delete" to better indicate it is a role not a name.
PS: why do I need to use @/AutoDelete and not a bot command? It's more convenient to use a bot command like "&", isn't it?
Thanks for the bot, it is working great!
To manage bot, we need "Manage Message" permission as you know.
Unfortunately, this restriction doesn't accept the perm from role.
So we need to apply role to each users one-by-one.
This behavior may not be smart.
Or, it causes on my environment only?
Hi! When I first invited the bot, it didn't respond to any commands. Then I kicked it and invited again. It started working. But when I returned after several hours, it agains seems not reacting to any commands
What can be the reason?
Its offline and won't delete messages
Seems the bot has stopped deleting in a channel that has been setup for a very long time. I tried to reset the settings but @AutoDelete set 0
and then setting it back to our original setting, but it seems the bot won't respond to any commands. Not even @AutoDelete help
.
It would be useful to use the pinned messages feature to mark important messages that shouldn't be automatically deleted, while still deleting the rest after the configured time.
The bot wont delete chats in the server and go offlineee
Since 2nd June the website can't be reached, this affects bot installation and most likely even the function that messages are deleted.
Can't test functionality cause i don't have a server with this bot installed but I would really like to use it in a server I just created.
It would be nice to have the bot leave messages from certain users and/or roles like admins outside of the pin function for if someone is posting a lot of things in between intervals of wanting other messages purged.
My daily docker builds started failing a couple of days ago. Any ideas?
docker build -t autodeletetest https://github.com/riking/AutoDelete.git
Current default time zone: 'Etc/UTC'
Local time is now: Thu Jun 23 13:03:15 UTC 2022.
Universal Time is now: Thu Jun 23 13:03:15 UTC 2022.
Run 'dpkg-reconfigure tzdata' if you wish to change it.
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
git is already the newest version (1:2.30.2-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
go: go.mod file not found in current directory or any parent directory.
'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
like 'go install example.com/cmd@latest'
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.
The command '/bin/sh -c apt update -y --allow-insecure-repositories && apt upgrade -y && apt install -y git && apt -y clean && go get -u -v github.com/riking/AutoDelete/cmd/autodelete' returned a non-zero code: 1
I would like to have the ability to type a command like "@autodelete servercheck or @autodelete guildcheck" and it would display a message of all the channels it is currently configured in. This would help out in bigger servers making sure that all the channels that need setup are without going into each channel.
Ex.
#Welcome (message count) (duration)
#Rules (message count) (duration)
and so on.
bot isnt working
Let's say I have an auto delete set at 3 messages and at 1 minute.
And I type this:
A B C D E F
Sometimes it will keep random parts of the message and never delete them even after the time has expired.
So after 10 minutes, it might read this:
C E
Any fix?
Bot offline
Instead of using an anonymous goroutine function, you can create named functions and use the go keyword to start them as goroutines. This makes the code easier to read and understand
Bot is added, all permissions set up correctly, but it doesn't want to work. Does it provide any sort of confirmation when mentioned? @autodelete start 100 24h, @autodelete help, etc. I get nothing. Ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.