Giter Club home page Giter Club logo

pokebot's People

Contributors

catlinman avatar fkaa avatar jokler avatar kilmanio avatar thegreatestjannet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pokebot's Issues

Play Local Music

Is your feature request related to a problem? Please describe.
It would be nice if the MusicBot would be able to play local music stored on device's hard drive.

Describe the solution you'd like
A command to browse the music in a folder and play it. Personally I'd like it play FLAC files but other format such as MP3 would be good too!

The bot panics if a user pokes it from a channel the bot is not subscribed to

Describe the bug
The user pokes the bot which causes it to panic and as a result the master bot disconnects.

To Reproduce
I have been able to reproduce this by creating a new channel and switching to it.

Expected behavior
The bot should be able to join the channel even after it just got created. In general this panic should be removed to prevent these kind of bugs from crashing the master bot in the future.

Additional context
Relevant LOC:

.expect("Can find poke sender");

Application can fail to shut down on SIGINT/SIGTERM

Describe the bug
When closing the bot by sending SIGINT or SIGTERM to it (e.g. by pressing Ctrl+C in the console) it disconnects but the tokio runtime does not shut down so the application keeps running.

To Reproduce
Details are currently unclear but it seems to happen consistently on my single core server under systemd. Neither of those are required to cause this behaviour though.

Expected behavior
The bot disconnects and then the application exits.

Gstreamer dash error message

Describe the bug
Gstreamer error when playing a video

To Reproduce
Add the following video: https://www.youtube.com/watch?v=uj97kISm1nc
See error message in console

Expected behavior
It should play the video without any errors

Additional context
ERROR unnamed[3041914752] src/audio_player.rs:373 - Received error from bus, musicbot: MusicBot, master: PokeBot, debug: Some("gstdecodebin2.c(4640): gst_decode_bin_expose (): /GstPipeline:TeamSpeak Audio Player/GstDecodeBin:decode bin:\nno suitable plugins found:\nMissing decoder: application/dash+xml (application/dash+xml)\n"), error: Your GStreamer installation is missing a plug-in., source: Some(GString(Foreign(0xaf521bc0, 59)))

Do I need to install a plugin to decode dash? I have base, good and ugly installed.

Bot doesn't play music when it joins a channel

Describe the bug
The bot joins the channel and doesn't play any music.

To Reproduce
Steps to reproduce the behavior:

  1. Poke the bot with the play command. I'm using play https://www.youtube.com/watch?v=djV11Xbc914
  2. New bot joins and doesn't play any music

Expected behavior
I expect the bot to join the channel and play music.

Additional context
I have gstreamer1.0-plugins-good installed and this is the console log:

18:29:50.751 INFO tokio-runtime-worker-2[3045056160] src/audio_player.rs:89 - Creating audio player
18:29:54.790 INFO tokio-runtime-worker-2[3045056160] src/audio_player.rs:208 - Setting volume: 0.5 -> -15.05149978319906 dB                                                                                                                  
18:29:54.790 INFO tokio-runtime-worker-2[3045056160] src/bot/music.rs:265 - Setting TeamsSpeak nickname to 🎵 MusicBot (50%)                                                                                                                 
18:29:54.791 DEBUG gstreamer polling[3011460768] src/audio_player.rs:334 - Polling GStreamer
18:29:54.791 DEBUG gstreamer polling[3011460768] src/audio_player.rs:365 - Pipeline transitioned from Null to Ready, with VoidPending pending

Reconnect automatically to server

Is your feature request related to a problem? Please describe.
Currently if the server goes down the bot needs to be manually restarted to reconnect to the server.

Describe the solution you'd like
The bot should automatically reconnect the server when it the server comes back online without any manual intervention.

Investigate structuring the bot(s) using actors

Is your feature request related to a problem? Please describe.
Currently the TeamSpeak/GStreamer parts of the bot is a bit of a mess with Mutexes/RwLock mixed with async functions

Describe the solution you'd like
See if we can move the concept of the main bot and the music bots into their own actors to decouple them more.

Describe alternatives you've considered
Try to clean up the current code?

Make logging per bot

Is your feature request related to a problem? Please describe.
With the multibot PR implemented it is not quite clear which specific bot logs where created by as soon as more than one is connected.

Describe the solution you'd like
The logging solution should be able to make a distinction between different bots. As an example it should be possible to log to dynamically create a log file whenever a new bot connects and write all related logs to that file.

Describe alternatives you've considered
I have not considered any alternatives though we might have to switch to slog to make these changes possible.

Relative volume change

Is your feature request related to a problem? Please describe.
Usually it is not clear which volume is good before you try it so relative adjustments are made. Currently this requires looking at the current volume, subtracting the relative amount and setting it to a new value.

Describe the solution you'd like
Relative adjustments could be made by prefixing the volume with either a '+' or a '-' just like how it works for seeking currently.

Describe alternatives you've considered
Relative adjustments can already be made manually, this would just be a comfort feature.

Add a config option for the default music bot volume

Is your feature request related to a problem? Please describe.
When a music bot it has a default volume preset, this volume is often too loud.

Describe the solution you'd like
A config option would allow the default volume to be changed per server.

Describe alternatives you've considered
Lower the default volume for everyone but since this is subjective I am against it.

Relevant line

player.change_volume(VolumeChange::Absolute(0.5)).unwrap();

Gstreamer occasionally stops working correctly

This is always caused by this kind of error:
13:41:00.409 ERROR unnamed[139971735492352] src/audio_player.rs:304 - Error from Some(Owned(0x7f4dac03acb0, 87)): Stream doesn't contain enough data. (Some("../gstreamer/plugins/elements/gsttypefindelement.c(986): gst_type_find_element_chain_do_typefinding (): /GstPipeline:TeamSpeak Audio

Pokebot crashing panicked at 'Can find poke sender'

Describe the bug
When I poke the bot it crashes trying to spawn the musicbot

To Reproduce
Make the bot join the server.
Poke the bot

Expected behavior
The bot should spawn and not crash.

Additional context

Started TeamSpeak 3 Music Bot.
Jul 24 10:09:39 raspberrypiserver pokebot[6209]: 10:09:39.747 INFO main[3070009376] src/main.rs:137 - Starting PokeBot!
Jul 24 10:09:39 raspberrypiserver pokebot[6209]: 10:09:39.748 DEBUG main[3070009376] src/main.rs:138 - Received CLI arguments: Args { inner: ["/home/username/pokebot/pokebot"] }
Jul 24 10:09:39 raspberrypiserver pokebot[6209]: 10:09:39.750 INFO tokio-runtime-worker-0[3055541920] src/bot/master.rs:38 - Starting in TeamSpeak mode
Jul 24 10:09:39 raspberrypiserver pokebot[6209]: Jul 24 10:09:39.752 INFO TsClientlib, tsproto-version: 0.1.0+50 (7d8237408 2020-01-12) dirty 1 modification, profile: Release, version: 0.1.0+50 (7d8237408 2020-01-12) dirty 1 modification
Jul 24 10:09:39 raspberrypiserver pokebot[6209]: addr: 192.168.3.3
Jul 24 10:09:39 raspberrypiserver pokebot[6209]:  module: resolver
Jul 24 10:09:39 raspberrypiserver pokebot[6209]:   Jul 24 10:09:39.753 DEBG Starting resolve, address: 192.168.3.3
Jul 24 10:09:39 raspberrypiserver pokebot[6209]:  Jul 24 10:09:39.753 DEBG Listening, local_addr: 0.0.0.0:54003
Jul 24 10:09:39 raspberrypiserver pokebot[6209]:  Jul 24 10:09:39.753 DEBG Connecting, address: 192.168.3.3:9987
Jul 24 10:09:39 raspberrypiserver pokebot[6209]:  addr: 192.168.3.3:9987
Jul 24 10:09:39 raspberrypiserver pokebot[6209]:   Jul 24 10:09:39.793 INFO Solve RSA puzzle, y: 1144494165867687186743094000330247603842065019998206928774300524137695298330303472265629055831987549644659990717122229185824117993898517904395585259214629, n: 10549065343402011594114806496421449442441372594177463479587369570102294413871928351537841505745047525467253161775247626451355751803352453425587161514780663, x: 123528265829957324860187199024705815682340119636384652041713945973297860306033058855941401621106248731739379411381639251505508911989051492204210781820454, level: 10000
Jul 24 10:09:39 raspberrypiserver pokebot[6209]:   name: Solve RSA puzzle
Jul 24 10:09:39 raspberrypiserver pokebot[6209]:    Jul 24 10:09:39.793 INFO time report, : 0.03566937
Jul 24 10:09:39 raspberrypiserver pokebot[6209]:   Jul 24 10:09:39.793 INFO Solve RSA puzzle, level: 10000
Jul 24 10:09:40 raspberrypiserver pokebot[6209]:  Jul 24 10:09:40.804 WARN Resend, threshold: 2020-07-24 09:09:39.804028676 UTC, rto: PT1S, srtt_dev: PT1.347960763S, srtt: PT2.932378478S, to: S, last: 2020-07-24 09:09:40.804028676 UTC, tries: 2, p_id: 0, p_type: Command
Jul 24 10:09:40 raspberrypiserver pokebot[6209]:   Jul 24 10:09:40.838 INFO Changed state, new: Normal, old: Connecting
Jul 24 10:09:40 raspberrypiserver pokebot[6209]: Unknown message channellistfinished
Jul 24 10:09:40 raspberrypiserver pokebot[6209]: Unknown message notifychannelgrouplist
Jul 24 10:09:40 raspberrypiserver pokebot[6209]: Unknown message notifyclientneededpermissions
Jul 24 10:09:40 raspberrypiserver pokebot[6209]: 10:09:40.879 INFO unnamed[3036667552] /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-server-1.0.1/src/builder.rs:263 - Starting 4 workers
Jul 24 10:09:40 raspberrypiserver pokebot[6209]: 10:09:40.880 INFO unnamed[3036667552] /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-server-1.0.1/src/builder.rs:275 - Starting "actix-web-service-127.0.0.1:45538" service on 127.0.0.1:45538
Jul 24 10:09:40 raspberrypiserver pokebot[6209]: 10:09:40.881 TRACE actix-rt:worker:2[3019865760] /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-2.0.0/src/middleware/logger.rs:296 - Access log format: %a "%r" %s %b "%{Referer}i" "%{User-Agent}i" %T
Jul 24 10:09:40 raspberrypiserver pokebot[6209]: 10:09:40.886 TRACE actix-rt:worker:3[3017764512] /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-2.0.0/src/middleware/logger.rs:296 - Access log format: %a "%r" %s %b "%{Referer}i" "%{User-Agent}i" %T
Jul 24 10:09:40 raspberrypiserver pokebot[6209]: 10:09:40.888 TRACE actix-rt:worker:1[3021967008] /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-2.0.0/src/middleware/logger.rs:296 - Access log format: %a "%r" %s %b "%{Referer}i" "%{User-Agent}i" %T
Jul 24 10:09:40 raspberrypiserver pokebot[6209]: 10:09:40.890 TRACE actix-rt:worker:0[3024068256] /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-2.0.0/src/middleware/logger.rs:296 - Access log format: %a "%r" %s %b "%{Referer}i" "%{User-Agent}i" %T
Jul 24 10:09:49 raspberrypiserver pokebot[6209]: 10:09:49.001 INFO tokio-runtime-worker-3[3042950816] src/bot/master.rs:208 - Poked by 10, creating bot for their channel
Jul 24 10:09:49 raspberrypiserver pokebot[6209]: thread 'tokio-runtime-worker-3' panicked at 'Can find poke sender', src/bot/master.rs:104:23
Jul 24 10:09:49 raspberrypiserver pokebot[6209]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Jul 24 10:09:49 raspberrypiserver pokebot[6209]: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Canceled', /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.22/src/runtime/threadpool/mod.rs:269:9
Jul 24 10:09:49 raspberrypiserver pokebot[6209]: thread 'tokio-runtime-worker-0' panicked at 'called `Result::unwrap()` on an `Err` value: SpawnError { is_shutdown: true }', /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-executor-0.1.9/src/global.rs:172:5

Panic after a music bot got stuck

Describe the bug
If a music bot gets kicked the next poke makes it panic and as a result the master bot disconnects.
This should be the offending line since the master bot is still keeping track of the kicked bot:

if bot.my_channel() == channel {

To Reproduce
Steps to reproduce the behavior:

  1. Kick a music bot
  2. Poke the master bot from the same channel the music bot was kicked from

Expected behavior
When kicked the bot should be removed from the list of connected bots but as with #26 this should not take down the master bot either way.

Additional context

Jul 06 17:37:32 jokler-arch pokebot[1987662]: INFO tokio-runtime-worker-0[139641523173120] src/bot/master.rs:208 - Poked by 28991, creating bot for their channel
Jul 06 17:37:32 jokler-arch pokebot[1987662]:  Jul 06 17:37:32.105 WARN Max resend timeout exceeded, dur: PT10.042998802S, p_id: 0
Jul 06 17:37:32 jokler-arch pokebot[1987662]:   Jul 06 17:37:32.105 INFO Changed state, new: Stalling, old: Normal
Jul 06 17:37:32 jokler-arch pokebot[1987662]:   Jul 06 17:37:32.106 INFO Changed state, new: Normal, old: Stalling
Jul 06 17:37:48 jokler-arch pokebot[1987662]: INFO tokio-runtime-worker-0[139641523173120] src/bot/master.rs:208 - Poked by 28991, creating bot for their channel
Jul 06 17:37:48 jokler-arch pokebot[1987662]: thread 'tokio-runtime-worker-0' panicked at 'can find myself', src/teamspeak/mod.rs:157:9

Bot sometimes disconnects

One worker thread seems to get stuck on gst_element_send_event() in pokebot::audio_player::AudioPlayer::stop_current().
One was waiting for epoll_wait from libc and the last one was waiting for a std::sync::mpsc::Receiver<T>::recv().

Add more information to the readme

The readme still lacks information about first time setup as well as explanations of how to use the bot in a bit more detail.
Known bugs could also be worth mentioning.

Add an option to the config file to disable the web server

Is your feature request related to a problem? Please describe.
Not everyone running the bot is interested in supporting a web server with API too.

Describe the solution you'd like
It should be possible to set a feature flag to remove the web server components at build time.

Bot sometimes skips songs when adding a new song just as the currently playing one is ending

Describe the bug
When adding a song when the currently playing song is ending, the added song gets skipped immediately.

To Reproduce
Steps to reproduce the behavior:

  1. Wait for song to end
  2. Add new song

Expected behavior
Newly added song should go to the end of the playlist

Additional context
Logs from @Jokler:

Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO tokio-runtime-worker-0[140625360508672] src/playlist.rs:19 - Adding Some("Children Of Bodom - Are You Dead Yet?") to playlist
Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO tokio-runtime-worker-0[140625360508672] src/playlist.rs:26 - Popping Some(Some("Story of The Year- The Antidote")) from playlist
Feb 07 21:09:59 jokler-arch pokebot[3916198]: DEBUG tokio-runtime-worker-0[140625360508672] src/bot/music.rs:212 - Sending message to TeamSpeak: Playing 'Story of The Year- The Antidote'
Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO tokio-runtime-worker-0[140625360508672] src/bot/music.rs:224 - Setting TeamsSpeak description to Currently playing 'Story of The Year- The Antidote'
Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO tokio-runtime-worker-0[140625360508672] src/audio_player.rs:199 - Setting pipeline state to null
Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO tokio-runtime-worker-0[140625360508672] src/audio_player.rs:169 - Setting location URI: https://r1---sn-4g5ednse.googlevideo.com/videoplayback?expire=1581127269&>
Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO tokio-runtime-worker-0[140625360508672] src/audio_player.rs:207 - Setting pipeline state to playing
Feb 07 21:09:59 jokler-arch pokebot[3916198]: DEBUG unnamed[140624843994880] src/audio_player.rs:282 - Pipeline transitioned from Null to Ready, with Playing pending
Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO tokio-runtime-worker-0[140625360508672] src/playlist.rs:26 - Popping Some(Some("Breaking Benjamin - Follow Me")) from playlist
Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO tokio-runtime-worker-0[140625360508672] src/bot/music.rs:316 - Advancing playlist
Feb 07 21:09:59 jokler-arch pokebot[3916198]: DEBUG tokio-runtime-worker-0[140625360508672] src/bot/music.rs:212 - Sending message to TeamSpeak: Playing 'Breaking Benjamin - Follow Me'
Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO tokio-runtime-worker-0[140625360508672] src/bot/music.rs:224 - Setting TeamsSpeak description to Currently playing 'Breaking Benjamin - Follow Me'
Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO tokio-runtime-worker-0[140625360508672] src/audio_player.rs:199 - Setting pipeline state to null
Feb 07 21:09:59 jokler-arch pokebot[3916198]: INFO unnamed[140624843994880] src/audio_player.rs:245 - Sending state Stopped to application

Tell users if the song is a local file or an online source

Currently when you use !search it searches the file system first and then an online source. However it never tells the users if it is playing a local song or an online song. Adding something like Playing local song Mr Blue Sky - Electric Light Orchestra or something similar would be pretty useful to tell.

Store name of the user who added a song

Is your feature request related to a problem? Please describe.
If a user joins the channel after the playlist has been filled they can't see who requested a song.

Describe the solution you'd like
On add the bot should check what the name of the message sender was and store it to display it later. This could be used in multiple places like in the message that gets sent when a new song starts.

Bot can still get stuck during shutdown

Describe the bug
For unknown reasons the bot does not always shut down after a panic.

To Reproduce
Steps to reproduce the behavior:

  1. Panic in a tokio worker thread.
  2. ??
  3. Bot does not shut down

Expected behavior
Bot should shut down cleanly no matter what the error was

Additional context

Jul 06 17:37:48 jokler-arch pokebot[1987662]: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Canceled', /home/jokler/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.22/src/runtime/threadpool/mod.rs:269:9
Jul 06 17:37:48 jokler-arch pokebot[1987662]: thread 'tokio-runtime-worker-0' panicked at 'called `Result::unwrap()` on an `Err` value: SpawnError { is_shutdown: true }', /home/jokler/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-executor-0.1.9/src/global.rs:172:5

Compile instructions

Is there any instructions for compiling the bot as I would like to run it on a raspberry pi with an ARM processor.

Browse local files through chat commands

Is your feature request related to a problem? Please describe.
Currently it is not possible to see what files are available through the filesystem.

Describe the solution you'd like
A chat command to list files or search them. Listing them could be similar to OS style commands(e.g. ls, cd).

Describe alternatives you've considered
Files could also be discovered through the web interface, though I think that should be a separate feature on its own.

Restructure MasterBotArgs into ConfigFile that contains Bot/Webserver configs

Is your feature request related to a problem? Please describe.
Currently the MasterBotArgs struct acts as the config file for the webserver too.

Describe the solution you'd like
The webserver configuration should be separate from the bot config with the config file being defined by a struct that contains both.

Additional context
Relevant lines of code:

#[derive(Debug, Serialize, Deserialize)]
pub struct MasterArgs {
#[serde(default = "default_name")]
pub master_name: String,
pub address: String,
pub channel: Option<String>,
#[serde(default = "default_verbose")]
pub verbose: u8,
pub domain: String,
pub bind_address: String,
pub webserver_enable: bool,
pub names: Vec<String>,
pub id: Option<Identity>,
pub ids: Option<Vec<Identity>>,
}

Default channel does not work

Describe the bug
Setting channel ID or name in config does not work. The bot does not join the specified channel, but still joining the lobby.

To Reproduce
Set a different channel ID or name than lobby and start the bot.

Expected behavior
The bot should join the specified channel.

Add a way of generating the inital identities for the config file

Describe the bug
Currently it is impossible to start the bot without having at least the master and one music bot identity.

To Reproduce

  1. Clone the repository
  2. Try to generate identities with '-g'

Expected behavior
The bot should generate a master identity and a music bot identity if they are missing.

Let users choose the name on poke

Is your feature request related to a problem? Please describe.
Once multibot is implemented the bot might run out of names even though it still has identities available. Additionally some users might enjoy using a bot with a custom name more.

Describe the solution you'd like
When the master bot is poked the user can put the custom name into the poke message.

Describe alternatives you've considered
Generating names randomly are an option but the generated names might not be as good and users who want to have a custom name for their bots wouldn't be able to do so.
Random names could still be added separately down the line.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.