Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor discord link #449

Merged
merged 12 commits into from
Nov 26, 2023
Merged

Conversation

Werzet
Copy link
Collaborator

@Werzet Werzet commented Oct 18, 2023

Описание PR

Поправил код привязок дискорд:

  • удалил хранение имени аккаунта дискорд и имени аккаунта игры. Их можно менять и нет смысла хранить в БД;
  • изменил тип поля ID профиля дискорд. В боте оно имеет тип ulong, значит нужно хранить в таком виде. Поменять просто его тип БД не даёт, поэтому пересоздаём столбец.

Медиа

Проверки

  • PR полностью завершён и мне не нужна помощь чтобы его закончить.
  • Я внимательно просмотрел все свои изменения и багов в них не нашёл.
  • Я запускал локальный сервер со своими изменениями и всё протестировал.
  • Я добавил скриншот/видео демонстрации PR в игре, или этот PR этого не требует.

Изменения

🆑

  • tweak: поправлена система хранения привязки дискорда

@Werzet
Copy link
Collaborator Author

Werzet commented Oct 18, 2023

Нужно придумать куда давать текст для привязки. С консоли и с чата выделять и копировать нельзя.
Можно либо показать окно, либо засунуть текст сразу в бефер пользователю.

@Sparrow-Ran
Copy link

В ахелп может быть? Оттуда копировать можно, вроде как.

@Sparrow-Ran
Copy link

А, нет, нельзя. Увы. Тогда как вариант сразу в буфер кидать текст.

@TheArturZh
Copy link
Member

Сразу в буфер это не очень хороший UX, не интуитивно и может потеряться. Лучше окно где можно выделять текст, можно даже для удобства кнопку "скопировать" приделать

@21Melkuu
Copy link

Такая система есть на коре, у них вроде просто нажать на кнопку и тебя там уже перекидывает куда надо. Через кнопку будет самый лучший вариант для игроков.

@TheArturZh
Copy link
Member

У нас уже бот есть, для начала хотя-бы через него, а потом уже и над привязкой через сайт подумать можно

@Werzet Werzet force-pushed the refactor-discord-link branch from f643ea8 to 041ae1b Compare November 7, 2023 02:07
@github-actions github-actions bot added the Changes: UI Изменение затронуло файлы ".xaml" label Nov 7, 2023
@github-actions github-actions bot added the Changes: Localization Изменение затронуло файлы ".ftl" label Nov 15, 2023
@Werzet Werzet marked this pull request as ready for review November 15, 2023 05:26
@Werzet Werzet requested a review from TheArturZh November 20, 2023 08:36
@TheArturZh
Copy link
Member

чот оно работать не горит желанием если снести БД/всунуть БД поюзанную на мастере

[ERRO] db.ef: Failed executing DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
ALTER TABLE "discord_players" ADD "discord_id" INTEGER NULL;
[DEBG] szr: Finalized string mapping of size 152188 in 344ms
[DEBG] szr: Wrote string package in 77ms size 792,69 KiB
[DEBG] szr: String hash is l1kPkW_o3sv8RBQn_ttSC_eD8c-v_LrtpX5aeDyoH_k
[INFO] toolshed: Initialized new toolshed context in 00:00:00.0612037
[INFO] ticker: Restarting round!
[DEBG] map: Restarting...
[FATL] unhandled: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'duplicate column name: discord_id'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
   at Content.Server.Database.ServerDbSqlite.<>c__DisplayClass4_0.<.ctor>b__0() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 53
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Content.Server.Database.ServerDbSqlite.GetDbImpl() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 548
   at Content.Server.Database.ServerDbSqlite.GetDb() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 561
   at Content.Server.Database.ServerDbBase.AddOrGetServer(String serverName) in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbBase.cs:line 748
   at Content.Server.Database.ServerDbManager.AddOrGetServer(String serverName) in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbManager.cs:line 611
   at Content.Server.GameTicking.GameTicker.<>c__DisplayClass105_0.<<IncrementRoundNumber>b__1>d.MoveNext() in E:\SS14Dev\space-station-14\Content.Server\GameTicking\GameTicker.GamePreset.cs:line 304
Unhandled exception. Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'duplicate column name: discord_id'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
   at Content.Server.Database.ServerDbSqlite.<>c__DisplayClass4_0.<.ctor>b__0() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 53
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Content.Server.Database.ServerDbSqlite.GetDbImpl() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 548
   at Content.Server.Database.ServerDbSqlite.GetDb() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 561
   at Content.Server.Database.ServerDbBase.AddOrGetServer(String serverName) in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbBase.cs:line 748
   at Content.Server.Database.ServerDbManager.AddOrGetServer(String serverName) in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbManager.cs:line 611
   at Content.Server.GameTicking.GameTicker.<>c__DisplayClass105_0.<<IncrementRoundNumber>b__1>d.MoveNext() in E:\SS14Dev\space-station-14\Content.Server\GameTicking\GameTicker.GamePreset.cs:line 304

@Werzet
Copy link
Collaborator Author

Werzet commented Nov 21, 2023

чот оно работать не горит желанием если снести БД/всунуть БД поюзанную на мастере

[ERRO] db.ef: Failed executing DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
ALTER TABLE "discord_players" ADD "discord_id" INTEGER NULL;
[DEBG] szr: Finalized string mapping of size 152188 in 344ms
[DEBG] szr: Wrote string package in 77ms size 792,69 KiB
[DEBG] szr: String hash is l1kPkW_o3sv8RBQn_ttSC_eD8c-v_LrtpX5aeDyoH_k
[INFO] toolshed: Initialized new toolshed context in 00:00:00.0612037
[INFO] ticker: Restarting round!
[DEBG] map: Restarting...
[FATL] unhandled: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'duplicate column name: discord_id'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
   at Content.Server.Database.ServerDbSqlite.<>c__DisplayClass4_0.<.ctor>b__0() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 53
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Content.Server.Database.ServerDbSqlite.GetDbImpl() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 548
   at Content.Server.Database.ServerDbSqlite.GetDb() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 561
   at Content.Server.Database.ServerDbBase.AddOrGetServer(String serverName) in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbBase.cs:line 748
   at Content.Server.Database.ServerDbManager.AddOrGetServer(String serverName) in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbManager.cs:line 611
   at Content.Server.GameTicking.GameTicker.<>c__DisplayClass105_0.<<IncrementRoundNumber>b__1>d.MoveNext() in E:\SS14Dev\space-station-14\Content.Server\GameTicking\GameTicker.GamePreset.cs:line 304
Unhandled exception. Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'duplicate column name: discord_id'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
   at Content.Server.Database.ServerDbSqlite.<>c__DisplayClass4_0.<.ctor>b__0() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 53
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Content.Server.Database.ServerDbSqlite.GetDbImpl() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 548
   at Content.Server.Database.ServerDbSqlite.GetDb() in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbSqlite.cs:line 561
   at Content.Server.Database.ServerDbBase.AddOrGetServer(String serverName) in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbBase.cs:line 748
   at Content.Server.Database.ServerDbManager.AddOrGetServer(String serverName) in E:\SS14Dev\space-station-14\Content.Server\Database\ServerDbManager.cs:line 611
   at Content.Server.GameTicking.GameTicker.<>c__DisplayClass105_0.<<IncrementRoundNumber>b__1>d.MoveNext() in E:\SS14Dev\space-station-14\Content.Server\GameTicking\GameTicker.GamePreset.cs:line 304

Точно обновил ветку у себя? Вроде правил уже такую ошибку.

@TheArturZh
Copy link
Member

И правда, fetch забыл

@Werzet Werzet force-pushed the refactor-discord-link branch from 2d7b771 to 68d3595 Compare November 26, 2023 09:57
@Redict Redict merged commit f6d51e6 into SerbiaStrong-220:master Nov 26, 2023
10 checks passed
@Werzet Werzet deleted the refactor-discord-link branch December 4, 2023 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes: Localization Изменение затронуло файлы ".ftl" Changes: UI Изменение затронуло файлы ".xaml" Status: Needs Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants